UNPKG

tonweb

Version:

TonWeb - JavaScript API for TON blockchain

48 lines (40 loc) 3.34 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script src="../dist/tonweb.js"></script> <script> async function testWalletV3() { const tonweb = new TonWeb(); const Address = TonWeb.Address; const cell = new TonWeb.boc.Cell(); const bitString = new TonWeb.boc.BitString(1023); console.assert(new Address('0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO').toString() === '0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO', 'non-bounce address'); console.assert(new Address('kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL').toString() === 'kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL', 'bounce address'); console.assert(new Address('0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3').toString() === '0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3', 'raw address'); console.assert(new Address('0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO').toString(true, true, false) === '0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO', 'non-bounce address 2'); console.assert(new Address('0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO').toString(true, true, true) === 'kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL', 'non-bounce address 2'); console.assert(new Address('0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO').toString(false) === '0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3', 'non-bounce address 2'); console.assert(new Address('kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL').toString(true, true, false) === '0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO', 'bounce address 2'); console.assert(new Address('kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL').toString(true, true, true) === 'kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL', 'bounce address 2'); console.assert(new Address('kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL').toString(false) === '0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3', 'bounce address 2'); console.assert(new Address('0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3').toString(true, true, false, true) === '0QAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi4-QO', 'raw address 2'); console.assert(new Address('0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3').toString(true, true, true, true) === 'kQAs9VlT6S776tq3unJcP5Ogsj-ELLunLXuOb1EKcOQi47nL', 'raw address 2'); console.assert(new Address('0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3').toString(false) === '0:2cf55953e92efbeadab7ba725c3f93a0b23f842cbba72d7b8e6f510a70e422e3', 'raw address 2'); const a = 'EQDjVXa_oltdBP64Nc__p397xLCvGm2IcZ1ba7anSW0NAkeP'; const address = new TonWeb.Address(a) console.log(await tonweb.getTransactions(address)); console.log(await tonweb.getBalance(address)); console.log(await tonweb.sendBoc(new Uint8Array(0))); console.log(await tonweb.call(address, 'seqno')); console.log(await tonweb.provider.getAddressInfo(a)); console.log(await tonweb.provider.getExtendedAddressInfo(a)); console.log(await tonweb.provider.getWalletInfo(a)); } testWalletV3(); </script> </body> </html>