@trustwallet/wallet-core 3.1.12 → 3.1.14

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 Ua(){Qa++;g.monitorRunDependencies&&g.monitorRunDependencies(Qa);assert
34
34
  function Va(){return G.startsWith("data:application/octet-stream;base64,")}function ma(a){return a.startsWith("file://")}function H(a){return function(){var b=g.asm;assert(Oa,"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 G;G="wallet-core.wasm";if(!Va()){var Wa=G;G=g.locateFile?g.locateFile(Wa,x):x+Wa}
35
35
  function Xa(){var a=G;try{if(a==G&&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 Ya(){if(!qa&&(ea||fa)){if("function"==typeof fetch&&!ma(G))return fetch(G,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+G+"'";return a.arrayBuffer()}).catch(function(){return Xa()});if(ja)return new Promise(function(a,b){ja(G,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Xa()})}
37
- var Za,$a,ab={641060:()=>{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";}}},641782:()=>g.ea()};function bb(a){for(;0<a.length;)a.shift()(g)}
37
+ var Za,$a,ab={641828:()=>{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";}}},642550:()=>g.ea()};function bb(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){cb||(cb={});cb[a]||(cb[a]=1,v&&(a="warning: "+a),y(a))}var cb,db=0;
39
39
  function eb(a){this.l=a-24;this.Sa=function(b){F[this.l+4>>2]=b};this.Ca=function(){return F[this.l+4>>2]};this.Ia=function(b){F[this.l+8>>2]=b};this.Ja=function(){E[this.l>>2]=0};this.Ha=function(){C[this.l+12>>0]=0};this.Ma=function(){C[this.l+13>>0]=0};this.Da=function(b,c){this.F(0);this.Sa(b);this.Ia(c);this.Ja();this.Ha();this.Ma()};this.F=function(b){F[this.l+16>>2]=b}}
40
40
  var fb=0,gb=(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},hb=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=gb(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},ib=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},jb=
@@ -149,7 +149,7 @@ invoke_iiiiii:Sd,invoke_v:Td,invoke_vi:Ud,invoke_vii:Vd,invoke_viii:Wd,invoke_vi
149
149
  (function(){function a(f){g.asm=f.exports;ra=g.asm.memory;assert(ra,"memory not found in wasm exports");Da();Fa=g.asm.__indirect_function_table;assert(Fa,"table not found in wasm exports");Ma.unshift(g.asm.__wasm_call_ctors);Qa--;g.monitorRunDependencies&&g.monitorRunDependencies(Qa);assert(Ta["wasm-instantiate"]);delete Ta["wasm-instantiate"];0==Qa&&(null!==Ra&&(clearInterval(Ra),Ra=null),Sa&&(f=Sa,Sa=null,f()))}function b(f){assert(g===e,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");
150
150
  e=null;a(f.instance)}function c(f){return Ya().then(function(h){return WebAssembly.instantiate(h,d)}).then(function(h){return h}).then(f,function(h){y("failed to asynchronously prepare wasm: "+h);ma(G)&&y("warning: Loading from a file URI ("+G+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing");n(h)})}var d={env:ae,wasi_snapshot_preview1:ae};Ua();var e=g;if(g.instantiateWasm)try{return g.instantiateWasm(d,
151
151
  a)}catch(f){y("Module.instantiateWasm callback failed with error: "+f),ba(f)}(function(){return qa||"function"!=typeof WebAssembly.instantiateStreaming||Va()||ma(G)||v||"function"!=typeof fetch?c(b):fetch(G,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(h){y("wasm streaming compile failed: "+h);y("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();g.___wasm_call_ctors=H("__wasm_call_ctors");
152
- var V=g._free=H("free"),Nd=g._malloc=H("malloc"),Md=g.___errno_location=H("__errno_location");g._fflush=H("fflush");var Xc=g.___getTypeName=H("__getTypeName");g.__embind_initialize_bindings=H("_embind_initialize_bindings");g._htonl=H("htonl");g._htons=H("htons");var xb=g._emscripten_builtin_memalign=H("emscripten_builtin_memalign");g._ntohs=H("ntohs");
152
+ var Nd=g._malloc=H("malloc"),V=g._free=H("free"),Md=g.___errno_location=H("__errno_location");g._fflush=H("fflush");var Xc=g.___getTypeName=H("__getTypeName");g.__embind_initialize_bindings=H("_embind_initialize_bindings");g._htonl=H("htonl");g._htons=H("htons");var xb=g._emscripten_builtin_memalign=H("emscripten_builtin_memalign");g._ntohs=H("ntohs");
153
153
  var X=g._setThrew=H("setThrew"),Kd=g.setTempRet0=H("setTempRet0"),be=g._emscripten_stack_init=function(){return(be=g._emscripten_stack_init=g.asm.emscripten_stack_init).apply(null,arguments)};g._emscripten_stack_get_free=function(){return(g._emscripten_stack_get_free=g.asm.emscripten_stack_get_free).apply(null,arguments)};g._emscripten_stack_get_base=function(){return(g._emscripten_stack_get_base=g.asm.emscripten_stack_get_base).apply(null,arguments)};
154
154
  var Ha=g._emscripten_stack_get_end=function(){return(Ha=g._emscripten_stack_get_end=g.asm.emscripten_stack_get_end).apply(null,arguments)},Y=g.stackSave=H("stackSave"),Z=g.stackRestore=H("stackRestore");g.stackAlloc=H("stackAlloc");g._emscripten_stack_get_current=function(){return(g._emscripten_stack_get_current=g.asm.emscripten_stack_get_current).apply(null,arguments)};g.___cxa_free_exception=H("__cxa_free_exception");var Ld=g.___cxa_can_catch=H("__cxa_can_catch");g.___cxa_is_pointer_type=H("__cxa_is_pointer_type");
155
155
  g.dynCall_jii=H("dynCall_jii");g.dynCall_ji=H("dynCall_ji");g.dynCall_iiji=H("dynCall_iiji");g.dynCall_iiiji=H("dynCall_iiiji");g.dynCall_jiii=H("dynCall_jiii");g.dynCall_jiiii=H("dynCall_jiiii");g.dynCall_iiij=H("dynCall_iiij");g.dynCall_iiiij=H("dynCall_iiiij");g.dynCall_jijjj=H("dynCall_jijjj");g.dynCall_jij=H("dynCall_jij");g.dynCall_viijii=H("dynCall_viijii");g.dynCall_viiiijijji=H("dynCall_viiiijijji");g.dynCall_iij=H("dynCall_iij");g.dynCall_vij=H("dynCall_vij");g.dynCall_jj=H("dynCall_jj");
Binary file
@@ -15,6 +15,42 @@ export namespace HexCoding {
15
15
  export function decode(hex: string): Uint8Array;
16
16
  export function encode(buffer: Uint8Array | Buffer): string;
17
17
  }
18
+ // Copyright © 2017-2023 Trust Wallet.
19
+ //
20
+ // This file is part of Trust. The full Trust copyright notice, including
21
+ // terms governing use, modification, and redistribution, is contained in the
22
+ // file LICENSE at the root of the source code distribution tree.
23
+
24
+ export class BitcoinSigHashTypeExt {
25
+ static isSingle(type: BitcoinSigHashType): boolean;
26
+ static isNone(type: BitcoinSigHashType): boolean;
27
+ }
28
+
29
+ export class CoinTypeExt {
30
+ static blockchain(coin: CoinType): Blockchain;
31
+ static purpose(coin: CoinType): Purpose;
32
+ static curve(coin: CoinType): Curve;
33
+ static xpubVersion(coin: CoinType): HDVersion;
34
+ static xprvVersion(coin: CoinType): HDVersion;
35
+ static hrp(coin: CoinType): HRP;
36
+ static p2pkhPrefix(coin: CoinType): number;
37
+ static p2shPrefix(coin: CoinType): number;
38
+ static staticPrefix(coin: CoinType): number;
39
+ static chainId(coin: CoinType): string;
40
+ static slip44Id(coin: CoinType): number;
41
+ static ss58Prefix(coin: CoinType): number;
42
+ static publicKeyType(coin: CoinType): PublicKeyType;
43
+ static validate(coin: CoinType, address: string): boolean;
44
+ static derivationPath(coin: CoinType): string;
45
+ static derivationPathWithDerivation(coin: CoinType, derivation: Derivation): string;
46
+ static deriveAddress(coin: CoinType, privateKey: PrivateKey): string;
47
+ static deriveAddressFromPublicKey(coin: CoinType, publicKey: PublicKey): string;
48
+ }
49
+
50
+ export class HDVersionExt {
51
+ static isPublic(version: HDVersion): boolean;
52
+ static isPrivate(version: HDVersion): boolean;
53
+ }
18
54
  export class AES {
19
55
  static encryptCBC(key: Uint8Array | Buffer, data: Uint8Array | Buffer, iv: Uint8Array | Buffer, mode: AESPaddingMode): Uint8Array;
20
56
  static decryptCBC(key: Uint8Array | Buffer, data: Uint8Array | Buffer, iv: Uint8Array | Buffer, mode: AESPaddingMode): Uint8Array;
@@ -768,6 +804,9 @@ export class TransactionCompiler {
768
804
  export interface WalletCore {
769
805
  AnySigner: typeof AnySigner;
770
806
  HexCoding: typeof HexCoding;
807
+ BitcoinSigHashTypeExt: typeof BitcoinSigHashTypeExt;
808
+ CoinTypeExt: typeof CoinTypeExt;
809
+ HDVersionExt: typeof HDVersionExt;
771
810
  AES: typeof AES;
772
811
  AESPaddingMode: typeof AESPaddingMode;
773
812
  Account: typeof Account;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/wallet-core",
3
- "version": "3.1.12",
3
+ "version": "3.1.14",
4
4
  "description": "wallet core wasm and protobuf models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "codegen:js-browser": "pbjs -t static-module '../src/proto/*.proto' -w closure --no-delimited --force-long -o ../samples/wasm/core_proto.js",
12
12
  "codegen:ts": "pbts -o generated/core_proto.d.ts generated/core_proto.js",
13
13
  "clean": "rm -rf dist generated && mkdir -p dist/generated generated",
14
- "build": "npm run clean && npm run generate && cp -R generated lib dist && tsc && cp src/wallet-core.d.ts dist/src",
15
- "build-and-test": "npm run copy:wasm && npm run build && npm test",
14
+ "build": "npm run copy:wasm && npm run clean && npm run generate && cp -R generated lib dist && tsc && cp src/wallet-core.d.ts dist/src",
15
+ "build-and-test": "npm run build && npm test",
16
16
  "copy:wasm": "mkdir -p lib && cp ../wasm-build/wasm/wallet-core.* lib",
17
17
  "copy:wasm-sample": "cp ../wasm-build/wasm/wallet-core.* ../samples/wasm/"
18
18
  },