diff --git a/examples/with-solana/README.md b/examples/with-solana/README.md index 1217ad20f..a6222413d 100644 --- a/examples/with-solana/README.md +++ b/examples/with-solana/README.md @@ -228,7 +228,7 @@ Non root user created with user id: 13c4609b-8818-40be-aeac-c8b63da0de4a We will now attempt to transfer these SPL tokens that we've created ```bash -$ pnpm token-transfer-policy attempt_transfer +$ pnpm token-transfer-policy attempt-transfer ``` This will prompt you first to enter in the Solana wallet address that is originating the transfer (use the address labeled "Turnkey Solana wallet address" output at the end of the setup step) @@ -261,7 +261,7 @@ details: [ This is the most important step! In this step we are taking our receiving address (the Turnkey Warchest), calculating it's "associated token address", given the Mint account address for the token we've created, and creating a policy that allows the correct non root user to sign Solana transactions if and only if they contain a single instruction that is an SPL token transfer to this associated token address. ```bash -$ pnpm token-transfer-policy create_token_policy +$ pnpm token-transfer-policy create-token-policy ``` This will prompt you first to enter in the user ID of the non root user who's credentials are being used to sign the transfer (use the value labeled "Non root user created with user id" output at the end of the setup step) diff --git a/examples/with-solana/src/tokenTransferPolicy.ts b/examples/with-solana/src/tokenTransferPolicy.ts index bc4b505a9..d7591a032 100644 --- a/examples/with-solana/src/tokenTransferPolicy.ts +++ b/examples/with-solana/src/tokenTransferPolicy.ts @@ -27,9 +27,9 @@ import keys from "./keys"; import { createUser, createPolicy } from "./requests"; const commands: { [key: string]: {} } = { - setup: {}, - attempt_transfer: {}, - create_token_policy: {}, + "setup": {}, + "attempt-transfer": {}, + "create-token-policy": {}, }; async function main() { @@ -49,17 +49,17 @@ async function main() { throw new Error(`setup command should have no arguments`); } await setup(); - } else if (command == "attempt_transfer") { + } else if (command == "attempt-transfer") { if (args.length != 1) { throw new Error( - `attempt_transfer comand should have no initial arguments -- you will be prompted` + `attempt-transfer comand should have no initial arguments -- you will be prompted` ); } await attemptTransferToken(); - } else if (command == "create_token_policy") { + } else if (command == "create-token-policy") { if (args.length != 1) { throw new Error( - `create_token_policy comand should have no initial arguments -- you will be prompted` + `create-token-policy comand should have no initial arguments -- you will be prompted` ); } await createTokenPolicy(); @@ -76,7 +76,7 @@ main().catch((error) => { * The setup command creates the onchain state (new token mint, sending and receiving token address etc) required for this example * It also creates SOME of the Turnkey setup state required (new Turnkey managed Solana wallet (owner of the sending token address) and non-root user * NOTE: The setup command DOES NOT create the policy that allows the non root user to send SPL tokens to the correct associated token address - * ^ the policy is created when you call create_token_policy + * ^ the policy is created when you call create-token-policy */ async function setup() { const turnkeyWarchest = new PublicKey(TURNKEY_WAR_CHEST); @@ -198,14 +198,14 @@ async function setup() { } /* - * The attemptTransferToken function runs the attempt_transfer command will attempt to make a token transfer using the created non-root user's API key credentials + * The attemptTransferToken function runs the attempt-transfer command will attempt to make a token transfer using the created non-root user's API key credentials * It will prompt you for the following information: * - The originating Solana wallet address (not token address) that was created and printed out during the setup stage * - The token mint account address of the token being transferred, also created and printed out during the setup stage * - * NOTE: This command IS EXPECTED TO FAIL IF the create_token_policy command has NOT been run to create the policy with the correct non-root user ID, and the correct token mint + * NOTE: This command IS EXPECTED TO FAIL IF the create-token-policy command has NOT been run to create the policy with the correct non-root user ID, and the correct token mint * - * To best illustrate what is going on in this example, run this command once before and once after running the create_token_policy command + * To best illustrate what is going on in this example, run this command once before and once after running the create-token-policy command */ async function attemptTransferToken() { let { solAddress } = await prompts([ @@ -286,14 +286,14 @@ async function attemptTransferToken() { } /* - * The createTokenPolicy function runs the create_token_policy command which creates the policy to allow the non root user to transfer the SPL token for this example + * The createTokenPolicy function runs the create-token-policy command which creates the policy to allow the non root user to transfer the SPL token for this example * This command will prompt you for the following information: * - The non root user ID that was created and printed out during the setup stage * - The token mint account address of the token being transferred, also created and printed out during the setup stage * - * NOTE: After running this command correctly, attempt_transfer (with the correct parameters) will work! + * NOTE: After running this command correctly, attempt-transfer (with the correct parameters) will work! * - * To best illustrate what is going on in this example, run attemp_transfer once without running this command to see it fail, then run this command and run attempt_transfer AGAIN + * To best illustrate what is going on in this example, run attemp-transfer once without running this command to see it fail, then run this command and run attempt-transfer AGAIN */ async function createTokenPolicy() { // Prompt user for the Non-root user created during setup