npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cafeca/tidewalletjs

v1.4.0

Published

TideWallet Core for javascript

Downloads

14

Readme

TideWallet JS

Browser

  1. Install browserify

    npm install -g browserify
  2. Build browserify js

    npm run build
    // browserify -r buffer src/index.js -o dist/bundle.js

Use TideWallet in Node

const TideWallet = require('./src/index.js');
const tw = new TideWallet();
tw.on('ready', () => { console.log('TideWallet is Ready'); });
tw.on('notice', () => { console.log('TideWallet Say Hello'); });
tw.on('update', (data) => {
  console.log('TideWallet Data Updated');
  console.log(data);
});


const api = {
  apiURL: 'https://staging.tidewallet.io/api/v1',
  apiKey: 'f2a76e8431b02f263a0e1a0c34a70466',
  apiSecret: '9e37d67450dc906042fde75113ecb78c',
};
const user = {
  thirdPartyId: 'myAppleID',
  installId: 'myInstallID'
};
const debugMode = true;
const networkPublish = false;

tw.init({ user, api, debugMode, networkPublish });

Use TideWallet in Browser

  • Build JS Library
git clone https://github.com/BOLT-Protocol/TideWalletJS
cd TideWalletJS
sudo npm i -g browserify
npm i
npm run build
  • Import Library
<script src="./lib/TideWallet.js" type="text/javascript"></script>
  • Regist TideWallet
const tidewallet = new TideWallet();
tidewallet.on('ready', () => { console.log('TideWallet is Ready'); });
tidewallet.on('update', () => { console.log('TideWallet Data Updated'); });
tidewallet.on('notice', () => { console.log('TideWallet Say Hello'); });
  • Initial with OAuth
const api = {
  apiURL: 'https://service.tidewallet.io/api/v1',
  apiKey: 'f2a76e8431b02f263a0e1a0c34a70466',
  apiSecret: '9e37d67450dc906042fde75113ecb78c',
};

const user = {
  OAuthID: 'myAppleID',
  TideWalletID: 'myTideWalletID',
  InstallID: 'myInstallID'
};

const debugMode = true;

const networkPublish = false;

tidewallet.init({ user, api, debugMode, networkPublish });
  • Initial with Mnemonic
const api = {
  apiURL: 'https://service.tidewallet.io/api/v1',
  apiKey: 'f2a76e8431b02f263a0e1a0c34a70466',
  apiSecret: '9e37d67450dc906042fde75113ecb78c',
};

const user = {
  thirdPartyId: 'myAppleID',
  InstallID: 'myInstallID',
  mnemonic: 'pudding cupboard inherit dry rate wet rough venture kitten parrot belt slush',
  passphase: 'asdf1234'
};
tidewallet.init({ mnemonic, api });
  • Get WalletConfig
let walletConfig = tidewallet.getWalletConfig()

// walletConfig = {
//   fiat: {
//     currencyId: "5b1ea92e584bf50020130613",
//     exchangeRate: BigNumber {s: 1, e: 0, c: Array(2)},
//     name: "CNY"
//   },
//   version: "1.0.0",
// }
  • Get Overview
let overview = await tidewallet.overview();

// overview = {
//   balance: "0",
//   currencies: [
//     {
//       accountId: "a7255d05-eacf-4278-9139-0cfceb9abed6",
//       accountType: "CFC",
//       accountcurrencyId: "a7255d05-eacf-4278-9139-0cfceb9abed6",
//       balance: "0",
//       currencyId: "7a55ef8a-a668-11eb-bcbc-0242ac130002",
//       lastSyncTime: 1624951601016,
//       numberOfUsedExternalKey: undefined,
//       numberOfUsedInternalKey: undefined,
//     },
//   ]
// }
  • Get Asset Detail and Transaction List
let assetDetail = await tidewallet.getAssetDetail({ assetID });

// assetDetail = {
//   asset: [
//     {
//       accountId: "a7255d05-eacf-4278-9139-0cfceb9abed6",
//       accountType: "CFC",
//       accountcurrencyId: "a7255d05-eacf-4278-9139-0cfceb9abed6",
//       balance: "0",
//       currencyId: "7a55ef8a-a668-11eb-bcbc-0242ac130002",
//       lastSyncTime: 1624951601016,
//       numberOfUsedExternalKey: undefined,
//       numberOfUsedInternalKey: undefined,
//     },
//   ],
//   transactions: [
//     {
//       accountcurrencyId: "a7255d05-eacf-4278-9139-0cfceb9abed6",
//       amount: "10",
//       confirmation: 764,
//       destinctionAddress: "0x49dcda35c2836296c5bc303525b4800276fdb907",
//       direction: "receive",
//       fee: "0.000021",
//       gasPrice: "0.000000001",
//       gasUsed: undefined,
//       note: "0x",
//       sourceAddress: "0x27642a1f15aa546c97b709a058b4434e93d28a29",
//       status: "success",
//       timestamp: 1624949933,
//       transactionId: "a7255d05-eacf-4278-9139-0cfceb9abed60x52fc770ee037f42a81313fceb2463928a47b9befe936b6596450c2f160e08cd2",
//       txId: "0x52fc770ee037f42a81313fceb2463928a47b9befe936b6596450c2f160e08cd2"
//     },
//   ],
// }
  • Get Transaction Detail
let transactionDetail = await tidewallet.getTransactionDetail({ transactionID });

// transactionDetail = {
//   accountcurrencyId: "a7255d05-eacf-4278-9139-0cfceb9abed6",
//   amount: "10",
//   confirmation: 764,
//   destinctionAddress: "0x49dcda35c2836296c5bc303525b4800276fdb907",
//   direction: "receive",
//   fee: "0.000021",
//   gasPrice: "0.000000001",
//   gasUsed: undefined,
//   note: "0x",
//   sourceAddress: "0x27642a1f15aa546c97b709a058b4434e93d28a29",
//   status: "success",
//   timestamp: 1624949933,
//   transactionId: "a7255d05-eacf-4278-9139-0cfceb9abed60x52fc770ee037f42a81313fceb2463928a47b9befe936b6596450c2f160e08cd2",
//   txId: "0x52fc770ee037f42a81313fceb2463928a47b9befe936b6596450c2f160e08cd2"
// }
  • Get Receiving Address
let address = await tidewallet.getReceivingAddress({ accountID });

// address = ["0x49dcda35c2836296c5bc303525b4800276fdb907", null]
  • Get Transaction Fee
let fee = await tidewallet.getTransactionFee({ accountID, blockchainID, from, to, amount, data });
  • Send a transaction
let rawTransaction = await tidewallet.prepareTransaction({ to, amount, data, fee });
let transaction = await tidewallet.sendTransaction(rawTransaction);
  • Perform a Manual Synchronization
tidewallet.sync();
  • Backup TideWallet
let paperWallet = tidewallet.backup();

// paperWallet = '{"keyObject":{"metadata":{"nonce":"FgiVWg8jCKsb3Mpz5L3KWeYRK4yhKQgo","iterations":10000},"public":{},"private":"aohJw4fPEXsgWv+TjlweHsRc4p0UHBhJvoTtDQ1uw7oMJTRglT5/7TwOtSisiyLCrHuiEkFuRcrp5O82fo99Ar8Qel0MtkP4hGs52uRfJ1DJjQ=="}}'
  • Close TideWallet
tidewallet.close();

Use TideWallet Core in browser

const user = { OAuthID: 'myAppleID', TideWalletID: 'myTideWalletID', InstallID: 'myInstallID' };
const core = new TideWallet.core();

await core.initial(user);

await core.recovery({ thirdPartyIdentity, TideBitIdentity, paperWallet }) // -- not work now

let extpubkey = await core.getExtendedPublicKey();

const keyPath = { chainIndex:0, keyIndex:0 };
const buffer = Buffer.from('8219f1cbbde29ac7e118bdba9a0b48a6e5f37a85ecd06701a1d8bc3f29c8de52', 'hex');

let signBuf = await core.sign({ keyPath, buffer });

let signData = await signData({ keyPath, jsonData }); // -- not work now
let signTx = awaitsignTransaction({ keyPath, coinType, value, data }); // -- not work now

Function List

  • getVersion
  • init
  • on
  • removeNotifier
  • createUser
  • resetWallet
  • getFiatList
  • changeSelectedFiat
  • getDebugMode
  • overview
  • getAssetDetail
  • getTransactionDetail
  • getReceivingAddress
  • verifyAddress
  • verifyAmount
  • getTransactionFee
  • sendTransaction
  • sync
  • partialSync
  • getBridgeAccountReceive
  • callContract
  • getExchangeRateList
  • backup
  • close
  • notice