MCPcopy Create free account
hub / github.com/cardstack/cardstack / transferTokens

Function transferTokens

packages/cardpay-cli/safe.ts:75–94  ·  view source on GitHub ↗
(
  network: string,
  safe: string,
  token: string,
  recipient: string,
  amount: string,
  mnemonic?: string
)

Source from the content-addressed store, hash-verified

73}
74
75export async function transferTokens(
76 network: string,
77 safe: string,
78 token: string,
79 recipient: string,
80 amount: string,
81 mnemonic?: string
82): Promise<void> {
83 let web3 = await getWeb3(network, mnemonic);
84 let weiAmount = toWei(amount);
85
86 let safes = await getSDK('Safes', web3);
87 let assets = await getSDK('Assets', web3);
88 let { symbol } = await assets.getTokenInfo(token);
89
90 console.log(`transferring ${amount} ${symbol} from safe ${safe} to ${recipient}`);
91 let result = await safes.sendTokens(safe, token, recipient, weiAmount);
92 let blockExplorer = await getConstant('blockExplorer', web3);
93 console.log(`Transaction hash: ${blockExplorer}/tx/${result.ethereumTx.txHash}/token-transfers`);
94}
95
96export async function setSupplierInfoDID(
97 network: string,

Callers 1

index.tsFile · 0.85

Calls 6

getWeb3Function · 0.90
getSDKFunction · 0.90
getConstantFunction · 0.90
sendTokensMethod · 0.80
getTokenInfoMethod · 0.65
logMethod · 0.45

Tested by

no test coverage detected