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

Function registerMerchant

packages/cardpay-cli/revenue-pool.ts:5–21  ·  view source on GitHub ↗
(
  network: string,
  prepaidCardAddress: string,
  infoDID: string | undefined,
  mnemonic?: string
)

Source from the content-addressed store, hash-verified

3import { getWeb3 } from './utils';
4
5export async function registerMerchant(
6 network: string,
7 prepaidCardAddress: string,
8 infoDID: string | undefined,
9 mnemonic?: string
10): Promise<void> {
11 let web3 = await getWeb3(network, mnemonic);
12 let revenuePool = await getSDK('RevenuePool', web3);
13 let blockExplorer = await getConstant('blockExplorer', web3);
14
15 console.log(
16 `Paying merchant registration fee in the amount of §${await revenuePool.merchantRegistrationFee()} SPEND from prepaid card address ${prepaidCardAddress}...`
17 );
18 let { merchantSafe, gnosisTxn } = (await revenuePool.registerMerchant(prepaidCardAddress, infoDID)) ?? {};
19 console.log(`Created merchant safe: ${merchantSafe}`);
20 console.log(`Transaction hash: ${blockExplorer}/tx/${gnosisTxn?.ethereumTx.txHash}/token-transfers`);
21}
22
23export async function revenueBalances(network: string, merchantSafeAddress: string, mnemonic?: string): Promise<void> {
24 let web3 = await getWeb3(network, mnemonic);

Callers 1

index.tsFile · 0.85

Calls 6

getWeb3Function · 0.90
getSDKFunction · 0.90
getConstantFunction · 0.90
registerMerchantMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected