Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* Resend the invitation email for sharing a BitGo wallet
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
const Promise = require('bluebird');
const BitGoJS = require('bitgo');
const bitgo = new BitGoJS.BitGo({ env: 'test' });
// TODO: set your access token here
const accessToken = null;
// TODO: set your wallet share ID here
// you can get this using the listShares() convienence method
const walletShareId = null;
const coin = 'tltc';
Promise.coroutine(function *() {
bitgo.authenticateWithAccessToken({ accessToken });
const shareResult = yield bitgo.coin(coin).wallets().resendShareInvite({ walletShareId });
console.log('Share invite resent successfully');
/**
* List all transfers on multi-sig wallets at BitGo for the given coin.
*
* This tool will help you see how to use the BitGo API to easily list your
* BitGo wallets.
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
const BitGoJS = require('bitgo');
const bitgo = new BitGoJS.BitGo({ env: 'test' });
const Promise = require('bluebird');
const coin = 'tltc';
const basecoin = bitgo.coin(coin);
// TODO: set your access token here
const accessToken = null;
const walletId = '5941ce2db42fcbc70717e5a898fd1595';
Promise.coroutine(function *() {
bitgo.authenticateWithAccessToken({ accessToken: accessToken });
const walletInstance = yield basecoin.wallets().get({ id: walletId });
const transfers = yield walletInstance.transfers();
console.log('Wallet ID:', walletInstance.id());
console.log('Current Receive Address:', walletInstance.receiveAddress());
/**
* List all transfers on multi-sig wallets at BitGo for the given coin.
*
* This tool will help you see how to use the BitGo API to easily list your
* BitGo wallets.
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
import { BitGo } from 'bitgo';
const bitgo = new BitGo({ env: 'test' });
const coin = 'tltc';
const basecoin = bitgo.coin(coin);
// TODO: set your access token here
const accessToken = '';
const walletId = '';
async function main() {
bitgo.authenticateWithAccessToken({ accessToken });
const walletInstance = await basecoin.wallets().get({ id: walletId });
const transfers = await walletInstance.transfers();
console.log('Wallet ID:', walletInstance.id());
console.log('Current Receive Address:', walletInstance.receiveAddress());
console.log('Wallet Transactions:', JSON.stringify(transfers, null, 4));
/**
* Send a transaction from a multi-sig wallet at BitGo.
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
const BitGoJS = require('bitgo');
const bitgo = new BitGoJS.BitGo({ env: 'test' });
const Promise = require('bluebird');
const coin = 'tltc';
const basecoin = bitgo.coin(coin);
// TODO: set your access token here
const accessToken = null;
const walletId = '5941ce2db42fcbc70717e5a898fd1595';
// TODO: set your passphrase here
const walletPassphrase = null;
Promise.coroutine(function *() {
bitgo.authenticateWithAccessToken({ accessToken: accessToken });
const walletInstance = yield basecoin.wallets().get({ id: walletId });
const newReceiveAddress1 = yield walletInstance.createAddress();
/**
* Create a multi-sig wallet at BitGo.
* This makes use of the convenience function generateWallet
*
* This tool will help you see how to use the BitGo API to easily create a wallet.
* In this form, it creates 2 keys on the host which runs this example.
* It is HIGHLY RECOMMENDED that you GENERATE THE KEYS ON SEPARATE MACHINES for real money wallets!
*
* To perform more advanced features, such as encrypting keys yourself, please look at createWalletAdvanced.js
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
import { BitGo } from 'bitgo';
const bitgo = new BitGo({ env: 'test' });
// TODO: set your access token here
const accessToken = '';
// TODO: set a label for your new wallet here
const label = 'Example Test Wallet';
// TODO: set your passphrase for your new wallet here
const passphrase = 'test_wallet_passphrase';
const coin = 'tltc';
// Create the wallet
async function main() {
bitgo.authenticateWithAccessToken({ accessToken });
/**
* Get the maximum amount spendable in a single transaction from a wallet.
* This value is the sum of the 200 most valuable unspent transactions in your wallet.
* This limit exists because an outbound transaction cannot use more than 200 unspent transactions as input,
* due to transaction size limits. Note that this value is NOT relevant for account-based coins
* i.e. [eth, xrp, xlm], as these coins do not use the unspent transactions data model
*
* Note that this value may be different than balance, confirmedBalance, and spendableBalance,
* which can be obtained using the example in the file: get-wallet-balance.ts
* Copyright 2018, BitGo, Inc. All Rights Reserved.
*/
import { BitGo } from 'bitgo';
const bitgo = new BitGo({ env: 'test' });
// TODO: set your access token here
// You can get this from User Settings > Developer Options > Add Access Token
const accessToken = '';
// TODO: get the wallet with this id
const id = '';
const coin = 'tbtc';
const basecoin = bitgo.coin(coin);
async function main() {
bitgo.authenticateWithAccessToken({ accessToken });
const walletInstance = await basecoin.wallets().get({ id: id });
/**
* Recover XRP from a multi-sig wallet at BitGo.
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
const Promise = require('bluebird');
const BitGoJS = require('bitgo');
const bitgo = new BitGoJS.BitGo({ env: 'prod' });
const coin = 'xrp';
const basecoin = bitgo.coin(coin);
Promise.coroutine(function *() {
const response = yield basecoin.recover({
// BOX A
userKey: '{"iv":"UgFBAnCOYhGpySRGlaLSrA==","v":1,"iter":10000,"ks":256,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"vMawLQuCAZI=","ct":"RTAgWQSJOroRfWF9GT8mxsTeFwXPBYuRf9k7UeDAHSao5EZH0E5EUo0dKm2gyogpc64HYfQhmkiQgKElDYq2/EdH+PXkSZxAzWrfFNVkgmM6CyWN1IMR8vvjLnBjNSlpYHQOLR733szlP5OFntf01soVsUZHb5A="}',
// BOX B
backupKey: '{"iv":"SS/5vfzJx8Nr+YIUVENZ4Q==","v":1,"iter":10000,"ks":256,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"8VP7bl5uSVM=","ct":"vITKMhfemxW6lrai1TXHpGFJhyksHXBIhZ5x3bQwDGeURyLrOiVRfvIuAk5vptSQOSwU8gmfMHOSweRMjEFkw8j0RwuYp79vrDY4pu47oo/iR6uiiZ1grCLjd27hO68SULPWXrMvzLvRb8ELh9EvuoByWnujyvM="}',
// BOX C
rootAddress: 'rB651yVavQSCEd6xi9pzg8QkHkPrR8gR4i',
/**
* Send a transaction from a multi-sig wallet at BitGo.
*
* Copyright 2019, BitGo, Inc. All Rights Reserved.
*/
import { BitGo, Coin } from 'bitgo';
const bitgo = new BitGo({ env: 'test' });
const coin = 'tltc';
const basecoin = bitgo.coin(coin) as Coin.Ltc;
// TODO: set your access token here
const accessToken = '';
const walletId = '5941ce2db42fcbc70717e5a898fd1595';
// TODO: set your passphrase here
const walletPassphrase = null;
async function main() {
bitgo.authenticateWithAccessToken({ accessToken });
const walletInstance = await basecoin.wallets().get({ id: walletId });
const newReceiveAddress1 = await walletInstance.createAddress();
const newReceiveAddress2 = await walletInstance.createAddress();
var Wallet = function (config) {
if (!(this instanceof Wallet)) { return new Wallet(config) }
this.config = config
this.bitgo = new (require('bitgo')).BitGo({ accessToken: config.bitgoAccessToken, env: 'prod' })
debug('environment: ' + this.bitgo.env)
}
(options, callback) => {
const bitgo = new BitGoJS.BitGo(options.config || { env: 'prod' })
const wallet = bitgo.newWalletObject({ wallet: { id: options.unsignedTx.walletId } })
try {
options.keychain.xprv = sjcl.decrypt(options.passphrase, options.keychain.encryptedXprv)
} catch (ex) { throw new Error('invalid passphrase') }
options.keychain.path = 'm'
wallet.signTransaction({
transactionHex: options.unsignedTx.transactionHex,
unspents: options.unsignedTx.unspents,
keychain: options.keychain
}, (err, signedTx) => {
if (err) return callback(err, null, options)
callback(null, signedTx, options)
})