@abuiles/

SetupAnchorFlags

Nodejs

No description

fork
loading
Files
  • index.js

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.08098341238198836","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"Y29uc3QgewogIEF1dGhSZXF1aXJlZEZsYWcsCiAgQXV0aFJldm9jYWJsZUZsYWcsCiAgU2VydmVyLAogIEtleXBhaXIsCiAgTmV0d29yaywKICBPcGVyYXRpb24sCiAgVHJhbnNhY3Rpb25CdWlsZGVyLAogIHhkcgp9ID0gcmVxdWlyZSgnc3RlbGxhci1zZGsnKQoKYXN5bmMgZnVuY3Rpb24gc2V0dXBJc3N1ZXIoKSB7CiAgTmV0d29yay51c2VUZXN0TmV0d29yaygpCgogIGNvbnN0IHN0ZWxsYXJTZXJ2ZXIgPSBuZXcgU2VydmVyKCdodHRwczovL2hvcml6b24tdGVzdG5ldC5zdGVsbGFyLm9yZycpCiAgY29uc3QgaXNzdWVyS2V5UGFpciA9IEtleXBhaXIuZnJvbVNlY3JldCgnU0JZWjVORUozNFkzRlRLQURWQk8zWTc2VTZWTFRSRUpTVzRNWFlDVk1VQlRMMkszVjRZNjQ0VVgnKQogIGNvbnN0IGlzc3VpbmdBY2NvdW50ID0gYXdhaXQgc3RlbGxhclNlcnZlci5sb2FkQWNjb3VudChpc3N1ZXJLZXlQYWlyLnB1YmxpY0tleSgpKQoKICB2YXIgdHJhbnNhY3Rpb24gPSBuZXcgVHJhbnNhY3Rpb25CdWlsZGVyKGlzc3VpbmdBY2NvdW50KQogICAgICAuYWRkT3BlcmF0aW9uKAogICAgICAgIE9wZXJhdGlvbi5zZXRPcHRpb25zKHsKICAgICAgICAgIHNldEZsYWdzOiBBdXRoUmV2b2NhYmxlRmxhZyB8IEF1dGhSZXF1aXJlZEZsYWcKICAgICAgICB9KSkKICAgICAgLmJ1aWxkKCkKCiAgdHJhbnNhY3Rpb24uc2lnbihpc3N1ZXJLZXlQYWlyKQogIGF3YWl0IHN0ZWxsYXJTZXJ2ZXIuc3VibWl0VHJhbnNhY3Rpb24odHJhbnNhY3Rpb24pCgogIGNvbnNvbGUubG9nKCdBbGwgc2V0IScpCn0KCnNldHVwSXNzdWVyKCkK"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const {
  AuthRequiredFlag,
  AuthRevocableFlag,
  Server,
  Keypair,
  Network,
  Operation,
  TransactionBuilder,
  xdr
} = require('stellar-sdk')

async function setupIssuer() {
  Network.useTestNetwork()

  const stellarServer = new Server('https://horizon-testnet.stellar.org')
  const issuerKeyPair = Keypair.fromSecret('SBYZ5NEJ34Y3FTKADVBO3Y76U6VLTREJSW4MXYCVMUBTL2K3V4Y644UX')
  const issuingAccount = await stellarServer.loadAccount(issuerKeyPair.publicKey())

  var transaction = new TransactionBuilder(issuingAccount)
      .addOperation(
        Operation.setOptions({
          setFlags: AuthRevocableFlag | AuthRequiredFlag
        }))
      .build()

  transaction.sign(issuerKeyPair)
  await stellarServer.submitTransaction(transaction)

  console.log('All set!')
}

setupIssuer()
node v10.16.0