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

Function getWeb3

packages/cardpay-cli/utils.ts:9–36  ·  view source on GitHub ↗
(network: string, mnemonic?: string)

Source from the content-addressed store, hash-verified

7const BRIDGE = 'https://safe-walletconnect.gnosis.io/';
8
9export async function getWeb3(network: string, mnemonic?: string): Promise<Web3> {
10 if (mnemonic) {
11 return new Web3(
12 new HDWalletProvider({
13 chainId: networkIds[network],
14 mnemonic: {
15 phrase: mnemonic,
16 },
17 providerOrUrl: new HttpProvider(await getConstant('rpcNode', network)),
18 })
19 );
20 } else {
21 let provider = new WalletConnectProvider({
22 clientMeta: {
23 description: '',
24 url: 'http://localhost:3000',
25 icons: [],
26 name: 'Cardstack',
27 },
28 rpc: {
29 [networkIds[network]]: getConstantByNetwork('rpcNode', network),
30 },
31 bridge: BRIDGE,
32 });
33 await provider.enable();
34 return new Web3((provider as unknown) as AbstractProvider);
35 }
36}

Callers 15

hubAuthFunction · 0.90
bridgeToLayer1Function · 0.90
awaitBridgedToLayer1Function · 0.90
claimLayer1BridgedTokensFunction · 0.90
bridgeToLayer2Function · 0.90
awaitBridgedToLayer2Function · 0.90
viewSafeFunction · 0.90
viewSafesFunction · 0.90
transferTokensFunction · 0.90
setSupplierInfoDIDFunction · 0.90
registerMerchantFunction · 0.90
revenueBalancesFunction · 0.90

Calls 2

getConstantFunction · 0.90
getConstantByNetworkFunction · 0.90

Tested by

no test coverage detected