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

Function create

packages/cardpay-cli/prepaid-card.ts:28–52  ·  view source on GitHub ↗
(
  network: string,
  safe: string,
  faceValues: number[],
  tokenAddress: string,
  customizationDID: string | undefined,
  mnemonic?: string
)

Source from the content-addressed store, hash-verified

26}
27
28export async function create(
29 network: string,
30 safe: string,
31 faceValues: number[],
32 tokenAddress: string,
33 customizationDID: string | undefined,
34 mnemonic?: string
35): Promise<void> {
36 let web3 = await getWeb3(network, mnemonic);
37
38 let prepaidCard = await getSDK('PrepaidCard', web3);
39 let blockExplorer = await getConstant('blockExplorer', web3);
40 let assets = await getSDK('Assets', web3);
41 let { symbol } = await assets.getTokenInfo(tokenAddress);
42
43 console.log(
44 `Creating prepaid card(s) with face value(s) §${faceValues.join(
45 ' SPEND, §'
46 )} SPEND and issuing token ${symbol} from depot ${safe}...`
47 );
48 let result = await prepaidCard.create(safe, tokenAddress, faceValues, customizationDID, (prepaidCardAddresses) =>
49 console.log(`Created new prepaid card(s): ${prepaidCardAddresses.join(', ')}`)
50 );
51 console.log(`Transaction hash: ${blockExplorer}/tx/${result.gnosisTxn.ethereumTx.txHash}/token-transfers`);
52}
53
54export async function split(
55 network: string,

Callers 1

provideInjectionsMethod · 0.50

Calls 6

getWeb3Function · 0.90
getSDKFunction · 0.90
getConstantFunction · 0.90
getTokenInfoMethod · 0.65
createMethod · 0.65
logMethod · 0.45

Tested by

no test coverage detected