@trustwallet/wallet-core 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,7 @@ function Ra(){H++;g.monitorRunDependencies&&g.monitorRunDependencies(H);assert(!
34
34
  function Sa(){return K.startsWith("data:application/octet-stream;base64,")}function ma(a){return a.startsWith("file://")}function M(a){return function(){var b=g.asm;assert(Na,"native function `"+a+"` called before runtime initialization");b[a]||assert(b[a],"exported native function `"+a+"` not found");return b[a].apply(null,arguments)}}var K;K="wallet-core.wasm";if(!Sa()){var Ta=K;K=g.locateFile?g.locateFile(Ta,x):x+Ta}
35
35
  function Ua(){var a=K;try{if(a==K&&qa)return new Uint8Array(qa);if(ka)return ka(a);throw"both async and sync fetching of the wasm failed";}catch(b){n(b)}}
36
36
  function Va(){if(!qa&&(ea||fa)){if("function"==typeof fetch&&!ma(K))return fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Ua()});if(ja)return new Promise(function(a,b){ja(K,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Ua()})}
37
- var Wa,Xa,Ya={2062036:()=>{if(void 0===g.ea)try{var a="object"===typeof window?window:self,b="undefined"!==typeof a.crypto?a.crypto:a.msCrypto;a=function(){var d=new Uint32Array(1);b.getRandomValues(d);return d[0]>>>0};a();g.ea=a}catch(d){try{var c=require("crypto");a=function(){var e=c.randomBytes(4);return(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0};a();g.ea=a}catch(e){throw"No secure random number generator found";}}},2062758:()=>g.ea()};function Za(a){for(;0<a.length;)a.shift()(g)}
37
+ var Wa,Xa,Ya={2062484:()=>{if(void 0===g.ea)try{var a="object"===typeof window?window:self,b="undefined"!==typeof a.crypto?a.crypto:a.msCrypto;a=function(){var d=new Uint32Array(1);b.getRandomValues(d);return d[0]>>>0};a();g.ea=a}catch(d){try{var c=require("crypto");a=function(){var e=c.randomBytes(4);return(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0};a();g.ea=a}catch(e){throw"No secure random number generator found";}}},2063206:()=>g.ea()};function Za(a){for(;0<a.length;)a.shift()(g)}
38
38
  function va(a){assert("number"===typeof a);return"0x"+a.toString(16).padStart(8,"0")}function pa(a){$a||($a={});$a[a]||($a[a]=1,v&&(a="warning: "+a),y(a))}var $a;function ab(a){this.l=a-24;this.Na=function(b){G[this.l+4>>2]=b};this.Ia=function(b){G[this.l+8>>2]=b};this.Ja=function(){F[this.l>>2]=0};this.Ea=function(){D[this.l+12>>0]=0};this.Ka=function(){D[this.l+13>>0]=0};this.I=function(b,c){this.Da();this.Na(b);this.Ia(c);this.Ja();this.Ea();this.Ka()};this.Da=function(){G[this.l+16>>2]=0}}
39
39
  var bb=0,cb=(a,b)=>{for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},db=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=cb(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},eb=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b},fb=
40
40
  a=>{if("/"===a)return"/";a=db(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)};
Binary file
@@ -399,6 +399,21 @@ export class CoinTypeConfiguration {
399
399
  static getID(type: CoinType): string;
400
400
  static getName(type: CoinType): string;
401
401
  }
402
+ export class CryptoBox {
403
+ static encryptEasy(mySecret: CryptoBoxSecretKey, otherPubkey: CryptoBoxPublicKey, message: Uint8Array | Buffer): Uint8Array;
404
+ static decryptEasy(mySecret: CryptoBoxSecretKey, otherPubkey: CryptoBoxPublicKey, encrypted: Uint8Array | Buffer): Uint8Array;
405
+ }
406
+ export class CryptoBoxPublicKey {
407
+ static isValid(data: Uint8Array | Buffer): boolean;
408
+ static createWithData(data: Uint8Array | Buffer): CryptoBoxPublicKey;
409
+ data(): Uint8Array;
410
+ delete(): void;
411
+ }
412
+ export class CryptoBoxSecretKey {
413
+ static create(): CryptoBoxSecretKey;
414
+ getPublicKey(): CryptoBoxPublicKey;
415
+ delete(): void;
416
+ }
402
417
  export class Curve {
403
418
  value: number;
404
419
  static secp256k1: Curve;
@@ -424,10 +439,12 @@ export class Derivation {
424
439
  value: number;
425
440
  static default: Derivation;
426
441
  static custom: Derivation;
427
- static segwit: Derivation;
428
- static legacy: Derivation;
429
- static testnet: Derivation;
430
- static solana: Derivation;
442
+ static bitcoinSegwit: Derivation;
443
+ static bitcoinLegacy: Derivation;
444
+ static bitcoinTestnet: Derivation;
445
+ static litecoinLegacy: Derivation;
446
+ static solanaSolana: Derivation;
447
+ static stratisSegwit: Derivation;
431
448
  }
432
449
  export class DerivationPath {
433
450
  static create(purpose: Purpose, coin: number, account: number, change: number, address: number): DerivationPath;
@@ -957,6 +974,9 @@ export class TONAddressConverter {
957
974
  static fromBoc(boc: string): string;
958
975
  static toUserFriendly(address: string, bounceable: boolean, testnet: boolean): string;
959
976
  }
977
+ export class TONWallet {
978
+ static buildV4R2StateInit(publicKey: PublicKey, workchain: number, walletId: number): string;
979
+ }
960
980
  export class TezosMessageSigner {
961
981
  static formatMessage(message: string, url: string): string;
962
982
  static inputToPayload(message: string): string;
@@ -1006,6 +1026,9 @@ export interface WalletCore {
1006
1026
  Cardano: typeof Cardano;
1007
1027
  CoinType: typeof CoinType;
1008
1028
  CoinTypeConfiguration: typeof CoinTypeConfiguration;
1029
+ CryptoBox: typeof CryptoBox;
1030
+ CryptoBoxPublicKey: typeof CryptoBoxPublicKey;
1031
+ CryptoBoxSecretKey: typeof CryptoBoxSecretKey;
1009
1032
  Curve: typeof Curve;
1010
1033
  DataVector: typeof DataVector;
1011
1034
  Derivation: typeof Derivation;
@@ -1052,6 +1075,7 @@ export interface WalletCore {
1052
1075
  StoredKeyEncryptionLevel: typeof StoredKeyEncryptionLevel;
1053
1076
  THORChainSwap: typeof THORChainSwap;
1054
1077
  TONAddressConverter: typeof TONAddressConverter;
1078
+ TONWallet: typeof TONWallet;
1055
1079
  TezosMessageSigner: typeof TezosMessageSigner;
1056
1080
  TransactionCompiler: typeof TransactionCompiler;
1057
1081
  TransactionDecoder: typeof TransactionDecoder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/wallet-core",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "wallet core wasm and protobuf models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",