From 2f87af578f26a7659b0c80fc9f5c2e74a88293f0 Mon Sep 17 00:00:00 2001 From: Omkar Shanbhag Date: Thu, 12 Dec 2024 16:08:33 -0800 Subject: [PATCH] prettier --- .../src/allowTokenTransferPolicy.ts | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/examples/with-solana/src/allowTokenTransferPolicy.ts b/examples/with-solana/src/allowTokenTransferPolicy.ts index 25904014..019e2333 100644 --- a/examples/with-solana/src/allowTokenTransferPolicy.ts +++ b/examples/with-solana/src/allowTokenTransferPolicy.ts @@ -72,12 +72,12 @@ main().catch((error) => { process.exit(1); }); -/* +/* * 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); const organizationId = process.env.ORGANIZATION_ID!; @@ -197,22 +197,23 @@ async function setup() { console.log(`Non root user created with user id: ${nonRootUserID}`); } -/* +/* * 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: + * 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 -*/ + */ async function attemptTransferToken() { let { solAddress } = await prompts([ { type: "text" as PromptType, name: "solAddress", - message: "Enter Solana wallet address originating tranfser (created during setup stage):", + message: + "Enter Solana wallet address originating tranfser (created during setup stage):", }, ]); solAddress = solAddress.trim(); @@ -221,7 +222,8 @@ async function attemptTransferToken() { { type: "text" as PromptType, name: "tokenMint", - message: "Enter Mint account address of token being transferred (created during setup stage):", + message: + "Enter Mint account address of token being transferred (created during setup stage):", }, ]); tokenMint = tokenMint.trim(); @@ -283,33 +285,35 @@ 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! - * + * * 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 let { nonRootUserID } = await prompts([ { type: "text" as PromptType, name: "nonRootUserID", - message: "Enter non-root user ID originating the transfer (created during setup stage):", + message: + "Enter non-root user ID originating the transfer (created during setup stage):", }, ]); nonRootUserID = nonRootUserID.trim(); - // Prompt user + // Prompt user let { tokenMint } = await prompts([ { type: "text" as PromptType, name: "tokenMint", - message: "Enter Mint account address of token being transferred (created during setup stage):", + message: + "Enter Mint account address of token being transferred (created during setup stage):", }, ]); tokenMint = tokenMint.trim();