@trustwallet/wallet-core 4.2.3 → 4.2.5
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.
- package/dist/generated/core_proto.d.ts +733 -502
- package/dist/generated/core_proto.js +2794 -2057
- package/dist/lib/wallet-core.js +1 -1
- package/dist/lib/wallet-core.wasm +0 -0
- package/dist/src/keystore/default-impl.d.ts +1 -0
- package/dist/src/keystore/default-impl.js +10 -2
- package/dist/src/keystore/types.d.ts +6 -1
- package/dist/src/wallet-core.d.ts +3 -2
- package/package.json +1 -1
package/dist/lib/wallet-core.js
CHANGED
@@ -36,7 +36,7 @@ function $a(a,b){var c=M;return sa||"function"!=typeof WebAssembly.instantiateSt
|
|
36
36
|
function z(a,b){Object.getOwnPropertyDescriptor(g,a)||Object.defineProperty(g,a,{configurable:!0,get:function(){n("Module."+a+" has been replaced with plain "+b+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}
|
37
37
|
function cb(a){return"FS_createPath"===a||"FS_createDataFile"===a||"FS_createPreloadedFile"===a||"FS_unlink"===a||"addRunDependency"===a||"FS_createLazyFile"===a||"FS_createDevice"===a||"removeRunDependency"===a}(function(a,b){"undefined"!==typeof globalThis&&Object.defineProperty(globalThis,a,{configurable:!0,get:function(){ya("`"+a+"` is not longer defined by emscripten. "+b)}})})("buffer","Please use HEAP8.buffer or wasmMemory.buffer");
|
38
38
|
function db(a){Object.getOwnPropertyDescriptor(g,a)||Object.defineProperty(g,a,{configurable:!0,get:function(){var b="'"+a+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";cb(a)&&(b+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you");n(b)}})}
|
39
|
-
var eb={
|
39
|
+
var eb={2088980:()=>{if(void 0===g.fa)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.fa=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.fa=a}catch(e){throw"No secure random number generator found";}}},2089702:()=>g.fa()};
|
40
40
|
function qa(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}function fb(a){for(;0<a.length;)a.shift()(g)}function za(a){assert("number"===typeof a);return"0x"+a.toString(16).padStart(8,"0")}function ya(a){gb||(gb={});gb[a]||(gb[a]=1,w&&(a="warning: "+a),y(a))}var gb,hb=[];function ib(a){var b=hb[a];b||(a>=hb.length&&(hb.length=a+1),hb[a]=b=Ha.get(a));assert(Ha.get(a)==b,"JavaScript-side Wasm function table mirror is out of date!");return b}
|
41
41
|
function jb(a){this.l=a-24;this.Oa=function(b){G[this.l+4>>2]=b};this.Ja=function(b){G[this.l+8>>2]=b};this.Ka=function(){F[this.l>>2]=0};this.Ea=function(){D[this.l+12>>0]=0};this.La=function(){D[this.l+13>>0]=0};this.I=function(b,c){this.Da();this.Oa(b);this.Ja(c);this.Ka();this.Ea();this.La()};this.Da=function(){G[this.l+16>>2]=0}}
|
42
42
|
var kb=0,lb=(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},mb=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=lb(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},nb=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},ob=
|
Binary file
|
@@ -14,6 +14,7 @@ export declare class Default implements Types.IKeyStore {
|
|
14
14
|
import(mnemonic: string, name: string, password: string, coins: CoinType[], encryption: StoredKeyEncryption): Promise<Types.Wallet>;
|
15
15
|
importKey(key: Uint8Array, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Types.Wallet>;
|
16
16
|
addAccounts(id: string, password: string, coins: CoinType[]): Promise<Types.Wallet>;
|
17
|
+
addAccountsWithDerivations(id: string, password: string, coins: Types.CoinWithDerivation[]): Promise<Types.Wallet>;
|
17
18
|
getKey(id: string, password: string, account: Types.ActiveAccount): Promise<PrivateKey>;
|
18
19
|
export(id: string, password: string): Promise<string | Uint8Array>;
|
19
20
|
}
|
@@ -76,12 +76,20 @@ var Default = /** @class */ (function () {
|
|
76
76
|
});
|
77
77
|
};
|
78
78
|
Default.prototype.addAccounts = function (id, password, coins) {
|
79
|
+
var Derivation = this.core.Derivation;
|
80
|
+
var coins_with_derivations = coins.map(function (coin) { return ({
|
81
|
+
coin: coin,
|
82
|
+
derivation: Derivation.default,
|
83
|
+
}); });
|
84
|
+
return this.addAccountsWithDerivations(id, password, coins_with_derivations);
|
85
|
+
};
|
86
|
+
Default.prototype.addAccountsWithDerivations = function (id, password, coins) {
|
79
87
|
var _this = this;
|
80
88
|
return this.load(id).then(function (wallet) {
|
81
89
|
var storedKey = _this.mapStoredKey(wallet);
|
82
90
|
var hdWallet = storedKey.wallet(Buffer.from(password));
|
83
|
-
coins.forEach(function (
|
84
|
-
storedKey.
|
91
|
+
coins.forEach(function (item) {
|
92
|
+
storedKey.accountForCoinDerivation(item.coin, item.derivation, hdWallet);
|
85
93
|
});
|
86
94
|
var newWallet = _this.mapWallet(storedKey);
|
87
95
|
storedKey.delete();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CoinType, PrivateKey, StoredKeyEncryption } from "../wallet-core";
|
1
|
+
import { CoinType, Derivation, PrivateKey, StoredKeyEncryption } from "../wallet-core";
|
2
2
|
export declare enum WalletType {
|
3
3
|
Mnemonic = "mnemonic",
|
4
4
|
PrivateKey = "privateKey",
|
@@ -27,6 +27,10 @@ export interface Wallet {
|
|
27
27
|
version: number;
|
28
28
|
activeAccounts: ActiveAccount[];
|
29
29
|
}
|
30
|
+
export interface CoinWithDerivation {
|
31
|
+
coin: CoinType;
|
32
|
+
derivation: Derivation;
|
33
|
+
}
|
30
34
|
export interface IKeyStore {
|
31
35
|
hasWallet(id: string): Promise<boolean>;
|
32
36
|
load(id: string): Promise<Wallet>;
|
@@ -35,6 +39,7 @@ export interface IKeyStore {
|
|
35
39
|
importKey(key: Uint8Array, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Wallet>;
|
36
40
|
importWallet(wallet: Wallet): Promise<void>;
|
37
41
|
addAccounts(id: string, password: string, coins: CoinType[]): Promise<Wallet>;
|
42
|
+
addAccountsWithDerivations(id: string, password: string, coins: CoinWithDerivation[]): Promise<Wallet>;
|
38
43
|
getKey(id: string, password: string, account: ActiveAccount): Promise<PrivateKey>;
|
39
44
|
delete(id: string, password: string): Promise<void>;
|
40
45
|
export(id: string, password: string): Promise<string | Uint8Array>;
|
@@ -231,6 +231,7 @@ export class Blockchain {
|
|
231
231
|
static nativeInjective: Blockchain;
|
232
232
|
static bitcoinCash: Blockchain;
|
233
233
|
static pactus: Blockchain;
|
234
|
+
static komodo: Blockchain;
|
234
235
|
}
|
235
236
|
export class Cardano {
|
236
237
|
static minAdaAmount(tokenBundle: Uint8Array | Buffer): number;
|
@@ -312,7 +313,6 @@ export class CoinType {
|
|
312
313
|
static optimism: CoinType;
|
313
314
|
static zksync: CoinType;
|
314
315
|
static arbitrum: CoinType;
|
315
|
-
static ecochain: CoinType;
|
316
316
|
static avalancheCChain: CoinType;
|
317
317
|
static xdai: CoinType;
|
318
318
|
static fantom: CoinType;
|
@@ -399,6 +399,7 @@ export class CoinType {
|
|
399
399
|
static bounceBit: CoinType;
|
400
400
|
static zkLinkNova: CoinType;
|
401
401
|
static pactus: CoinType;
|
402
|
+
static sonic: CoinType;
|
402
403
|
}
|
403
404
|
export class CoinTypeConfiguration {
|
404
405
|
static getSymbol(type: CoinType): string;
|
@@ -587,11 +588,11 @@ export class EthereumChainID {
|
|
587
588
|
static optimism: EthereumChainID;
|
588
589
|
static xdai: EthereumChainID;
|
589
590
|
static smartbch: EthereumChainID;
|
591
|
+
static sonic: EthereumChainID;
|
590
592
|
static fantom: EthereumChainID;
|
591
593
|
static boba: EthereumChainID;
|
592
594
|
static kcc: EthereumChainID;
|
593
595
|
static zksync: EthereumChainID;
|
594
|
-
static heco: EthereumChainID;
|
595
596
|
static acalaevm: EthereumChainID;
|
596
597
|
static metis: EthereumChainID;
|
597
598
|
static polygonzkevm: EthereumChainID;
|