|
| 1 | +import { BitGoAPI } from '@bitgo/sdk-api'; |
| 2 | +import { Tpolygon } from '@bitgo/sdk-coin-polygon'; // Replace with your given coin (e.g. Ltc, Tltc) |
| 3 | + |
| 4 | +// This script emulates a front-end using the BitGo SDK to BitGo backend via a proxy. |
| 5 | +// Set up the BitGo connection object. |
| 6 | +const bitgo = new BitGoAPI({ |
| 7 | + // TODO: your developer access token to the BitGo platform API |
| 8 | + accessToken: 'your-token', |
| 9 | + // Set as prod/test as needed for whatever BitGo environment you want to use. |
| 10 | + // This *must* match the BitGo platform API your proxy instance is using. |
| 11 | + env: 'test', |
| 12 | + // TODO: In your real setup this would be <your.proxy.url>, where you host the proxy server. |
| 13 | + proxy: 'http://localhost:3000', |
| 14 | +}); |
| 15 | +const coin = 'tpolygon'; |
| 16 | +bitgo.register(coin, Tpolygon.createInstance); |
| 17 | + |
| 18 | +async function createTSSWalletSimple() { |
| 19 | + const newWallet = await bitgo |
| 20 | + .coin(coin) |
| 21 | + .wallets() |
| 22 | + .generateWallet({ |
| 23 | + label: 'hot multisig wallet ' + Math.floor(Date.now() / 1000), |
| 24 | + // TODO: your wallet password |
| 25 | + passphrase: 'VerySecurePassword1234', |
| 26 | + // TODO: your enterprise ID |
| 27 | + enterprise: 'your-enterprise-id', |
| 28 | + multisigType: 'tss', |
| 29 | + walletVersion: 3, |
| 30 | + }); |
| 31 | + console.log(JSON.stringify(newWallet, undefined, 2)); |
| 32 | +} |
| 33 | + |
| 34 | +async function main() { |
| 35 | + await createTSSWalletSimple(); |
| 36 | +} |
| 37 | + |
| 38 | +main(); |
0 commit comments