Last active
July 26, 2022 03:50
-
-
Save justinbarry/f6a0be0737bf80624de7d54c239597ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST -H "Content-Type: application/json" -d '{"code": "import FungibleToken from 0xf233dcee88fe0abe\nimport FiatToken from 0xb19436aae4d94622\n\ntransaction {\n prepare(signer: AuthAccount) {\n // Return early if the account already stores a FiatToken Vault\n if signer.borrow<&FiatToken.Vault>(from: FiatToken.VaultStoragePath) != nil {\n return\n }\n // Create a new ExampleToken Vault and put it in storage\n signer.save(\n <-FiatToken.createEmptyVault(),\n to: FiatToken.VaultStoragePath\n )\n // Create a public capability to the Vault that only exposes\n // the deposit function through the Receiver interface\n signer.link<&FiatToken.Vault{FungibleToken.Receiver}>(\n FiatToken.VaultReceiverPubPath,\n target: FiatToken.VaultStoragePath\n )\n // Create a public capability to the Vault that only exposes\n // the UUID() function through the VaultUUID interface\n signer.link<&FiatToken.Vault{FiatToken.ResourceId}>(\n FiatToken.VaultUUIDPubPath,\n target: FiatToken.VaultStoragePath\n )\n // Create a public capability to the Vault that only exposes\n // the balance field through the Balance interface\n signer.link<&FiatToken.Vault{FungibleToken.Balance}>(\n FiatToken.VaultBalancePubPath,\n target: FiatToken.VaultStoragePath\n )\n }\n}", "arguments": []} | |
' https://YOUR_WALLET_API/v1/accounts/THE_ACCOUNT_TO_SETUP/transactions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"code": "import FungibleToken from 0xf233dcee88fe0abe\nimport FiatToken from 0xb19436aae4d94622\n\ntransaction {\n prepare(signer: AuthAccount) {\n // Return early if the account already stores a FiatToken Vault\n if signer.borrow<&FiatToken.Vault>(from: FiatToken.VaultStoragePath) != nil {\n return\n }\n // Create a new ExampleToken Vault and put it in storage\n signer.save(\n <-FiatToken.createEmptyVault(),\n to: FiatToken.VaultStoragePath\n )\n // Create a public capability to the Vault that only exposes\n // the deposit function through the Receiver interface\n signer.link<&FiatToken.Vault{FungibleToken.Receiver}>(\n FiatToken.VaultReceiverPubPath,\n target: FiatToken.VaultStoragePath\n )\n // Create a public capability to the Vault that only exposes\n // the UUID() function through the VaultUUID interface\n signer.link<&FiatToken.Vault{FiatToken.ResourceId}>(\n FiatToken.VaultUUIDPubPath,\n target: FiatToken.VaultStoragePath\n )\n // Create a public capability to the Vault that only exposes\n // the balance field through the Balance interface\n signer.link<&FiatToken.Vault{FungibleToken.Balance}>(\n FiatToken.VaultBalancePubPath,\n target: FiatToken.VaultStoragePath\n )\n }\n}", | |
"arguments": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FungibleToken from 0xf233dcee88fe0abe | |
import FiatToken from 0xb19436aae4d94622 | |
transaction { | |
prepare(signer: AuthAccount) { | |
// Return early if the account already stores a FiatToken Vault | |
if signer.borrow<&FiatToken.Vault>(from: FiatToken.VaultStoragePath) != nil { | |
return | |
} | |
// Create a new ExampleToken Vault and put it in storage | |
signer.save( | |
<-FiatToken.createEmptyVault(), | |
to: FiatToken.VaultStoragePath | |
) | |
// Create a public capability to the Vault that only exposes | |
// the deposit function through the Receiver interface | |
signer.link<&FiatToken.Vault{FungibleToken.Receiver}>( | |
FiatToken.VaultReceiverPubPath, | |
target: FiatToken.VaultStoragePath | |
) | |
// Create a public capability to the Vault that only exposes | |
// the UUID() function through the VaultUUID interface | |
signer.link<&FiatToken.Vault{FiatToken.ResourceId}>( | |
FiatToken.VaultUUIDPubPath, | |
target: FiatToken.VaultStoragePath | |
) | |
// Create a public capability to the Vault that only exposes | |
// the balance field through the Balance interface | |
signer.link<&FiatToken.Vault{FungibleToken.Balance}>( | |
FiatToken.VaultBalancePubPath, | |
target: FiatToken.VaultStoragePath | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment