@trustwallet/wallet-core 4.1.8-rc1 → 4.1.8-rc2
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 +85 -0
- package/dist/generated/core_proto.js +244 -0
- package/dist/lib/wallet-core.js +1 -1
- package/dist/lib/wallet-core.wasm +0 -0
- package/dist/src/keystore/default-impl.d.ts +0 -1
- package/dist/src/keystore/default-impl.js +3 -33
- package/dist/src/keystore/types.d.ts +1 -3
- package/dist/src/keystore/types.js +0 -1
- package/dist/src/wallet-core.d.ts +0 -8
- package/package.json +1 -1
@@ -14634,6 +14634,85 @@ export namespace TW {
|
|
14634
14634
|
public toJSON(): { [k: string]: any };
|
14635
14635
|
}
|
14636
14636
|
|
14637
|
+
/** Properties of an Access. */
|
14638
|
+
interface IAccess {
|
14639
|
+
|
14640
|
+
/** Access address */
|
14641
|
+
address?: (string|null);
|
14642
|
+
|
14643
|
+
/** Access storedKeys */
|
14644
|
+
storedKeys?: (Uint8Array[]|null);
|
14645
|
+
}
|
14646
|
+
|
14647
|
+
/** Represents an Access. */
|
14648
|
+
class Access implements IAccess {
|
14649
|
+
|
14650
|
+
/**
|
14651
|
+
* Constructs a new Access.
|
14652
|
+
* @param [properties] Properties to set
|
14653
|
+
*/
|
14654
|
+
constructor(properties?: TW.Ethereum.Proto.IAccess);
|
14655
|
+
|
14656
|
+
/** Access address. */
|
14657
|
+
public address: string;
|
14658
|
+
|
14659
|
+
/** Access storedKeys. */
|
14660
|
+
public storedKeys: Uint8Array[];
|
14661
|
+
|
14662
|
+
/**
|
14663
|
+
* Creates a new Access instance using the specified properties.
|
14664
|
+
* @param [properties] Properties to set
|
14665
|
+
* @returns Access instance
|
14666
|
+
*/
|
14667
|
+
public static create(properties?: TW.Ethereum.Proto.IAccess): TW.Ethereum.Proto.Access;
|
14668
|
+
|
14669
|
+
/**
|
14670
|
+
* Encodes the specified Access message. Does not implicitly {@link TW.Ethereum.Proto.Access.verify|verify} messages.
|
14671
|
+
* @param message Access message or plain object to encode
|
14672
|
+
* @param [writer] Writer to encode to
|
14673
|
+
* @returns Writer
|
14674
|
+
*/
|
14675
|
+
public static encode(message: TW.Ethereum.Proto.IAccess, writer?: $protobuf.Writer): $protobuf.Writer;
|
14676
|
+
|
14677
|
+
/**
|
14678
|
+
* Decodes an Access message from the specified reader or buffer.
|
14679
|
+
* @param reader Reader or buffer to decode from
|
14680
|
+
* @param [length] Message length if known beforehand
|
14681
|
+
* @returns Access
|
14682
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
14683
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
14684
|
+
*/
|
14685
|
+
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TW.Ethereum.Proto.Access;
|
14686
|
+
|
14687
|
+
/**
|
14688
|
+
* Verifies an Access message.
|
14689
|
+
* @param message Plain object to verify
|
14690
|
+
* @returns `null` if valid, otherwise the reason why it is not
|
14691
|
+
*/
|
14692
|
+
public static verify(message: { [k: string]: any }): (string|null);
|
14693
|
+
|
14694
|
+
/**
|
14695
|
+
* Creates an Access message from a plain object. Also converts values to their respective internal types.
|
14696
|
+
* @param object Plain object
|
14697
|
+
* @returns Access
|
14698
|
+
*/
|
14699
|
+
public static fromObject(object: { [k: string]: any }): TW.Ethereum.Proto.Access;
|
14700
|
+
|
14701
|
+
/**
|
14702
|
+
* Creates a plain object from an Access message. Also converts values to other types if specified.
|
14703
|
+
* @param message Access
|
14704
|
+
* @param [options] Conversion options
|
14705
|
+
* @returns Plain object
|
14706
|
+
*/
|
14707
|
+
public static toObject(message: TW.Ethereum.Proto.Access, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
14708
|
+
|
14709
|
+
/**
|
14710
|
+
* Converts this Access to JSON.
|
14711
|
+
* @returns JSON object
|
14712
|
+
*/
|
14713
|
+
public toJSON(): { [k: string]: any };
|
14714
|
+
}
|
14715
|
+
|
14637
14716
|
/** Properties of a SigningInput. */
|
14638
14717
|
interface ISigningInput {
|
14639
14718
|
|
@@ -14669,6 +14748,9 @@ export namespace TW {
|
|
14669
14748
|
|
14670
14749
|
/** SigningInput userOperation */
|
14671
14750
|
userOperation?: (TW.Ethereum.Proto.IUserOperation|null);
|
14751
|
+
|
14752
|
+
/** SigningInput accessList */
|
14753
|
+
accessList?: (TW.Ethereum.Proto.IAccess[]|null);
|
14672
14754
|
}
|
14673
14755
|
|
14674
14756
|
/** Represents a SigningInput. */
|
@@ -14713,6 +14795,9 @@ export namespace TW {
|
|
14713
14795
|
/** SigningInput userOperation. */
|
14714
14796
|
public userOperation?: (TW.Ethereum.Proto.IUserOperation|null);
|
14715
14797
|
|
14798
|
+
/** SigningInput accessList. */
|
14799
|
+
public accessList: TW.Ethereum.Proto.IAccess[];
|
14800
|
+
|
14716
14801
|
/**
|
14717
14802
|
* Creates a new SigningInput instance using the specified properties.
|
14718
14803
|
* @param [properties] Properties to set
|
@@ -43975,6 +43975,206 @@
|
|
43975
43975
|
return UserOperation;
|
43976
43976
|
})();
|
43977
43977
|
|
43978
|
+
Proto.Access = (function() {
|
43979
|
+
|
43980
|
+
/**
|
43981
|
+
* Properties of an Access.
|
43982
|
+
* @memberof TW.Ethereum.Proto
|
43983
|
+
* @interface IAccess
|
43984
|
+
* @property {string|null} [address] Access address
|
43985
|
+
* @property {Array.<Uint8Array>|null} [storedKeys] Access storedKeys
|
43986
|
+
*/
|
43987
|
+
|
43988
|
+
/**
|
43989
|
+
* Constructs a new Access.
|
43990
|
+
* @memberof TW.Ethereum.Proto
|
43991
|
+
* @classdesc Represents an Access.
|
43992
|
+
* @implements IAccess
|
43993
|
+
* @constructor
|
43994
|
+
* @param {TW.Ethereum.Proto.IAccess=} [properties] Properties to set
|
43995
|
+
*/
|
43996
|
+
function Access(properties) {
|
43997
|
+
this.storedKeys = [];
|
43998
|
+
if (properties)
|
43999
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
44000
|
+
if (properties[keys[i]] != null)
|
44001
|
+
this[keys[i]] = properties[keys[i]];
|
44002
|
+
}
|
44003
|
+
|
44004
|
+
/**
|
44005
|
+
* Access address.
|
44006
|
+
* @member {string} address
|
44007
|
+
* @memberof TW.Ethereum.Proto.Access
|
44008
|
+
* @instance
|
44009
|
+
*/
|
44010
|
+
Access.prototype.address = "";
|
44011
|
+
|
44012
|
+
/**
|
44013
|
+
* Access storedKeys.
|
44014
|
+
* @member {Array.<Uint8Array>} storedKeys
|
44015
|
+
* @memberof TW.Ethereum.Proto.Access
|
44016
|
+
* @instance
|
44017
|
+
*/
|
44018
|
+
Access.prototype.storedKeys = $util.emptyArray;
|
44019
|
+
|
44020
|
+
/**
|
44021
|
+
* Creates a new Access instance using the specified properties.
|
44022
|
+
* @function create
|
44023
|
+
* @memberof TW.Ethereum.Proto.Access
|
44024
|
+
* @static
|
44025
|
+
* @param {TW.Ethereum.Proto.IAccess=} [properties] Properties to set
|
44026
|
+
* @returns {TW.Ethereum.Proto.Access} Access instance
|
44027
|
+
*/
|
44028
|
+
Access.create = function create(properties) {
|
44029
|
+
return new Access(properties);
|
44030
|
+
};
|
44031
|
+
|
44032
|
+
/**
|
44033
|
+
* Encodes the specified Access message. Does not implicitly {@link TW.Ethereum.Proto.Access.verify|verify} messages.
|
44034
|
+
* @function encode
|
44035
|
+
* @memberof TW.Ethereum.Proto.Access
|
44036
|
+
* @static
|
44037
|
+
* @param {TW.Ethereum.Proto.IAccess} message Access message or plain object to encode
|
44038
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
44039
|
+
* @returns {$protobuf.Writer} Writer
|
44040
|
+
*/
|
44041
|
+
Access.encode = function encode(message, writer) {
|
44042
|
+
if (!writer)
|
44043
|
+
writer = $Writer.create();
|
44044
|
+
if (message.address != null && Object.hasOwnProperty.call(message, "address"))
|
44045
|
+
writer.uint32(/* id 1, wireType 2 =*/10).string(message.address);
|
44046
|
+
if (message.storedKeys != null && message.storedKeys.length)
|
44047
|
+
for (var i = 0; i < message.storedKeys.length; ++i)
|
44048
|
+
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.storedKeys[i]);
|
44049
|
+
return writer;
|
44050
|
+
};
|
44051
|
+
|
44052
|
+
/**
|
44053
|
+
* Decodes an Access message from the specified reader or buffer.
|
44054
|
+
* @function decode
|
44055
|
+
* @memberof TW.Ethereum.Proto.Access
|
44056
|
+
* @static
|
44057
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
44058
|
+
* @param {number} [length] Message length if known beforehand
|
44059
|
+
* @returns {TW.Ethereum.Proto.Access} Access
|
44060
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
44061
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
44062
|
+
*/
|
44063
|
+
Access.decode = function decode(reader, length) {
|
44064
|
+
if (!(reader instanceof $Reader))
|
44065
|
+
reader = $Reader.create(reader);
|
44066
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.Ethereum.Proto.Access();
|
44067
|
+
while (reader.pos < end) {
|
44068
|
+
var tag = reader.uint32();
|
44069
|
+
switch (tag >>> 3) {
|
44070
|
+
case 1:
|
44071
|
+
message.address = reader.string();
|
44072
|
+
break;
|
44073
|
+
case 2:
|
44074
|
+
if (!(message.storedKeys && message.storedKeys.length))
|
44075
|
+
message.storedKeys = [];
|
44076
|
+
message.storedKeys.push(reader.bytes());
|
44077
|
+
break;
|
44078
|
+
default:
|
44079
|
+
reader.skipType(tag & 7);
|
44080
|
+
break;
|
44081
|
+
}
|
44082
|
+
}
|
44083
|
+
return message;
|
44084
|
+
};
|
44085
|
+
|
44086
|
+
/**
|
44087
|
+
* Verifies an Access message.
|
44088
|
+
* @function verify
|
44089
|
+
* @memberof TW.Ethereum.Proto.Access
|
44090
|
+
* @static
|
44091
|
+
* @param {Object.<string,*>} message Plain object to verify
|
44092
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
44093
|
+
*/
|
44094
|
+
Access.verify = function verify(message) {
|
44095
|
+
if (typeof message !== "object" || message === null)
|
44096
|
+
return "object expected";
|
44097
|
+
if (message.address != null && message.hasOwnProperty("address"))
|
44098
|
+
if (!$util.isString(message.address))
|
44099
|
+
return "address: string expected";
|
44100
|
+
if (message.storedKeys != null && message.hasOwnProperty("storedKeys")) {
|
44101
|
+
if (!Array.isArray(message.storedKeys))
|
44102
|
+
return "storedKeys: array expected";
|
44103
|
+
for (var i = 0; i < message.storedKeys.length; ++i)
|
44104
|
+
if (!(message.storedKeys[i] && typeof message.storedKeys[i].length === "number" || $util.isString(message.storedKeys[i])))
|
44105
|
+
return "storedKeys: buffer[] expected";
|
44106
|
+
}
|
44107
|
+
return null;
|
44108
|
+
};
|
44109
|
+
|
44110
|
+
/**
|
44111
|
+
* Creates an Access message from a plain object. Also converts values to their respective internal types.
|
44112
|
+
* @function fromObject
|
44113
|
+
* @memberof TW.Ethereum.Proto.Access
|
44114
|
+
* @static
|
44115
|
+
* @param {Object.<string,*>} object Plain object
|
44116
|
+
* @returns {TW.Ethereum.Proto.Access} Access
|
44117
|
+
*/
|
44118
|
+
Access.fromObject = function fromObject(object) {
|
44119
|
+
if (object instanceof $root.TW.Ethereum.Proto.Access)
|
44120
|
+
return object;
|
44121
|
+
var message = new $root.TW.Ethereum.Proto.Access();
|
44122
|
+
if (object.address != null)
|
44123
|
+
message.address = String(object.address);
|
44124
|
+
if (object.storedKeys) {
|
44125
|
+
if (!Array.isArray(object.storedKeys))
|
44126
|
+
throw TypeError(".TW.Ethereum.Proto.Access.storedKeys: array expected");
|
44127
|
+
message.storedKeys = [];
|
44128
|
+
for (var i = 0; i < object.storedKeys.length; ++i)
|
44129
|
+
if (typeof object.storedKeys[i] === "string")
|
44130
|
+
$util.base64.decode(object.storedKeys[i], message.storedKeys[i] = $util.newBuffer($util.base64.length(object.storedKeys[i])), 0);
|
44131
|
+
else if (object.storedKeys[i].length)
|
44132
|
+
message.storedKeys[i] = object.storedKeys[i];
|
44133
|
+
}
|
44134
|
+
return message;
|
44135
|
+
};
|
44136
|
+
|
44137
|
+
/**
|
44138
|
+
* Creates a plain object from an Access message. Also converts values to other types if specified.
|
44139
|
+
* @function toObject
|
44140
|
+
* @memberof TW.Ethereum.Proto.Access
|
44141
|
+
* @static
|
44142
|
+
* @param {TW.Ethereum.Proto.Access} message Access
|
44143
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
44144
|
+
* @returns {Object.<string,*>} Plain object
|
44145
|
+
*/
|
44146
|
+
Access.toObject = function toObject(message, options) {
|
44147
|
+
if (!options)
|
44148
|
+
options = {};
|
44149
|
+
var object = {};
|
44150
|
+
if (options.arrays || options.defaults)
|
44151
|
+
object.storedKeys = [];
|
44152
|
+
if (options.defaults)
|
44153
|
+
object.address = "";
|
44154
|
+
if (message.address != null && message.hasOwnProperty("address"))
|
44155
|
+
object.address = message.address;
|
44156
|
+
if (message.storedKeys && message.storedKeys.length) {
|
44157
|
+
object.storedKeys = [];
|
44158
|
+
for (var j = 0; j < message.storedKeys.length; ++j)
|
44159
|
+
object.storedKeys[j] = options.bytes === String ? $util.base64.encode(message.storedKeys[j], 0, message.storedKeys[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.storedKeys[j]) : message.storedKeys[j];
|
44160
|
+
}
|
44161
|
+
return object;
|
44162
|
+
};
|
44163
|
+
|
44164
|
+
/**
|
44165
|
+
* Converts this Access to JSON.
|
44166
|
+
* @function toJSON
|
44167
|
+
* @memberof TW.Ethereum.Proto.Access
|
44168
|
+
* @instance
|
44169
|
+
* @returns {Object.<string,*>} JSON object
|
44170
|
+
*/
|
44171
|
+
Access.prototype.toJSON = function toJSON() {
|
44172
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
44173
|
+
};
|
44174
|
+
|
44175
|
+
return Access;
|
44176
|
+
})();
|
44177
|
+
|
43978
44178
|
Proto.SigningInput = (function() {
|
43979
44179
|
|
43980
44180
|
/**
|
@@ -43992,6 +44192,7 @@
|
|
43992
44192
|
* @property {Uint8Array|null} [privateKey] SigningInput privateKey
|
43993
44193
|
* @property {TW.Ethereum.Proto.ITransaction|null} [transaction] SigningInput transaction
|
43994
44194
|
* @property {TW.Ethereum.Proto.IUserOperation|null} [userOperation] SigningInput userOperation
|
44195
|
+
* @property {Array.<TW.Ethereum.Proto.IAccess>|null} [accessList] SigningInput accessList
|
43995
44196
|
*/
|
43996
44197
|
|
43997
44198
|
/**
|
@@ -44003,6 +44204,7 @@
|
|
44003
44204
|
* @param {TW.Ethereum.Proto.ISigningInput=} [properties] Properties to set
|
44004
44205
|
*/
|
44005
44206
|
function SigningInput(properties) {
|
44207
|
+
this.accessList = [];
|
44006
44208
|
if (properties)
|
44007
44209
|
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
44008
44210
|
if (properties[keys[i]] != null)
|
@@ -44097,6 +44299,14 @@
|
|
44097
44299
|
*/
|
44098
44300
|
SigningInput.prototype.userOperation = null;
|
44099
44301
|
|
44302
|
+
/**
|
44303
|
+
* SigningInput accessList.
|
44304
|
+
* @member {Array.<TW.Ethereum.Proto.IAccess>} accessList
|
44305
|
+
* @memberof TW.Ethereum.Proto.SigningInput
|
44306
|
+
* @instance
|
44307
|
+
*/
|
44308
|
+
SigningInput.prototype.accessList = $util.emptyArray;
|
44309
|
+
|
44100
44310
|
/**
|
44101
44311
|
* Creates a new SigningInput instance using the specified properties.
|
44102
44312
|
* @function create
|
@@ -44143,6 +44353,9 @@
|
|
44143
44353
|
$root.TW.Ethereum.Proto.Transaction.encode(message.transaction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
|
44144
44354
|
if (message.userOperation != null && Object.hasOwnProperty.call(message, "userOperation"))
|
44145
44355
|
$root.TW.Ethereum.Proto.UserOperation.encode(message.userOperation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
|
44356
|
+
if (message.accessList != null && message.accessList.length)
|
44357
|
+
for (var i = 0; i < message.accessList.length; ++i)
|
44358
|
+
$root.TW.Ethereum.Proto.Access.encode(message.accessList[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim();
|
44146
44359
|
return writer;
|
44147
44360
|
};
|
44148
44361
|
|
@@ -44197,6 +44410,11 @@
|
|
44197
44410
|
case 11:
|
44198
44411
|
message.userOperation = $root.TW.Ethereum.Proto.UserOperation.decode(reader, reader.uint32());
|
44199
44412
|
break;
|
44413
|
+
case 12:
|
44414
|
+
if (!(message.accessList && message.accessList.length))
|
44415
|
+
message.accessList = [];
|
44416
|
+
message.accessList.push($root.TW.Ethereum.Proto.Access.decode(reader, reader.uint32()));
|
44417
|
+
break;
|
44200
44418
|
default:
|
44201
44419
|
reader.skipType(tag & 7);
|
44202
44420
|
break;
|
@@ -44259,6 +44477,15 @@
|
|
44259
44477
|
if (error)
|
44260
44478
|
return "userOperation." + error;
|
44261
44479
|
}
|
44480
|
+
if (message.accessList != null && message.hasOwnProperty("accessList")) {
|
44481
|
+
if (!Array.isArray(message.accessList))
|
44482
|
+
return "accessList: array expected";
|
44483
|
+
for (var i = 0; i < message.accessList.length; ++i) {
|
44484
|
+
var error = $root.TW.Ethereum.Proto.Access.verify(message.accessList[i]);
|
44485
|
+
if (error)
|
44486
|
+
return "accessList." + error;
|
44487
|
+
}
|
44488
|
+
}
|
44262
44489
|
return null;
|
44263
44490
|
};
|
44264
44491
|
|
@@ -44335,6 +44562,16 @@
|
|
44335
44562
|
throw TypeError(".TW.Ethereum.Proto.SigningInput.userOperation: object expected");
|
44336
44563
|
message.userOperation = $root.TW.Ethereum.Proto.UserOperation.fromObject(object.userOperation);
|
44337
44564
|
}
|
44565
|
+
if (object.accessList) {
|
44566
|
+
if (!Array.isArray(object.accessList))
|
44567
|
+
throw TypeError(".TW.Ethereum.Proto.SigningInput.accessList: array expected");
|
44568
|
+
message.accessList = [];
|
44569
|
+
for (var i = 0; i < object.accessList.length; ++i) {
|
44570
|
+
if (typeof object.accessList[i] !== "object")
|
44571
|
+
throw TypeError(".TW.Ethereum.Proto.SigningInput.accessList: object expected");
|
44572
|
+
message.accessList[i] = $root.TW.Ethereum.Proto.Access.fromObject(object.accessList[i]);
|
44573
|
+
}
|
44574
|
+
}
|
44338
44575
|
return message;
|
44339
44576
|
};
|
44340
44577
|
|
@@ -44351,6 +44588,8 @@
|
|
44351
44588
|
if (!options)
|
44352
44589
|
options = {};
|
44353
44590
|
var object = {};
|
44591
|
+
if (options.arrays || options.defaults)
|
44592
|
+
object.accessList = [];
|
44354
44593
|
if (options.defaults) {
|
44355
44594
|
if (options.bytes === String)
|
44356
44595
|
object.chainId = "";
|
@@ -44428,6 +44667,11 @@
|
|
44428
44667
|
object.transaction = $root.TW.Ethereum.Proto.Transaction.toObject(message.transaction, options);
|
44429
44668
|
if (message.userOperation != null && message.hasOwnProperty("userOperation"))
|
44430
44669
|
object.userOperation = $root.TW.Ethereum.Proto.UserOperation.toObject(message.userOperation, options);
|
44670
|
+
if (message.accessList && message.accessList.length) {
|
44671
|
+
object.accessList = [];
|
44672
|
+
for (var j = 0; j < message.accessList.length; ++j)
|
44673
|
+
object.accessList[j] = $root.TW.Ethereum.Proto.Access.toObject(message.accessList[j], options);
|
44674
|
+
}
|
44431
44675
|
return object;
|
44432
44676
|
};
|
44433
44677
|
|
package/dist/lib/wallet-core.js
CHANGED
@@ -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={
|
37
|
+
var Wa,Xa,Ya={2078740:()=>{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";}}},2079462:()=>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
|
@@ -13,7 +13,6 @@ export declare class Default implements Types.IKeyStore {
|
|
13
13
|
importWallet(wallet: Types.Wallet): Promise<void>;
|
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
|
-
importTON(tonMnemonic: string, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Types.Wallet>;
|
17
16
|
addAccounts(id: string, password: string, coins: CoinType[]): Promise<Types.Wallet>;
|
18
17
|
getKey(id: string, password: string, account: Types.ActiveAccount): Promise<PrivateKey>;
|
19
18
|
export(id: string, password: string): Promise<string | Uint8Array>;
|
@@ -75,23 +75,6 @@ var Default = /** @class */ (function () {
|
|
75
75
|
.catch(function (error) { return reject(error); });
|
76
76
|
});
|
77
77
|
};
|
78
|
-
Default.prototype.importTON = function (tonMnemonic, name, password, coin, encryption) {
|
79
|
-
var _this = this;
|
80
|
-
return new Promise(function (resolve, reject) {
|
81
|
-
var _a = _this.core, StoredKey = _a.StoredKey, TONWallet = _a.TONWallet;
|
82
|
-
var passphrase = "";
|
83
|
-
if (!TONWallet.isValidMnemonic(tonMnemonic, passphrase)) {
|
84
|
-
throw Types.Error.InvalidMnemonic;
|
85
|
-
}
|
86
|
-
var pass = Buffer.from(password);
|
87
|
-
var storedKey = StoredKey.importTONWalletWithEncryption(tonMnemonic, name, pass, coin, encryption);
|
88
|
-
var wallet = _this.mapWallet(storedKey);
|
89
|
-
storedKey.delete();
|
90
|
-
_this.importWallet(wallet)
|
91
|
-
.then(function () { return resolve(wallet); })
|
92
|
-
.catch(function (error) { return reject(error); });
|
93
|
-
});
|
94
|
-
};
|
95
78
|
Default.prototype.addAccounts = function (id, password, coins) {
|
96
79
|
var _this = this;
|
97
80
|
return this.load(id).then(function (wallet) {
|
@@ -110,21 +93,11 @@ var Default = /** @class */ (function () {
|
|
110
93
|
var _this = this;
|
111
94
|
return this.load(id).then(function (wallet) {
|
112
95
|
var storedKey = _this.mapStoredKey(wallet);
|
96
|
+
var hdWallet = storedKey.wallet(Buffer.from(password));
|
113
97
|
var coin = _this.core.CoinType.values["" + account.coin];
|
114
|
-
var privateKey;
|
115
|
-
switch (wallet.type) {
|
116
|
-
// In case of BIP39 mnemonic, we should use the custom derivation path.
|
117
|
-
case Types.WalletType.Mnemonic:
|
118
|
-
var hdWallet = storedKey.wallet(Buffer.from(password));
|
119
|
-
privateKey = hdWallet.getKey(coin, account.derivationPath);
|
120
|
-
hdWallet.delete();
|
121
|
-
break;
|
122
|
-
// Otherwise, use the default implementation.
|
123
|
-
default:
|
124
|
-
privateKey = storedKey.privateKey(coin, Buffer.from(password));
|
125
|
-
break;
|
126
|
-
}
|
98
|
+
var privateKey = hdWallet.getKey(coin, account.derivationPath);
|
127
99
|
storedKey.delete();
|
100
|
+
hdWallet.delete();
|
128
101
|
return privateKey;
|
129
102
|
});
|
130
103
|
};
|
@@ -140,9 +113,6 @@ var Default = /** @class */ (function () {
|
|
140
113
|
case Types.WalletType.PrivateKey:
|
141
114
|
value = storedKey.decryptPrivateKey(Buffer.from(password));
|
142
115
|
break;
|
143
|
-
case Types.WalletType.TonMnemonic:
|
144
|
-
value = storedKey.decryptTONMnemonic(Buffer.from(password));
|
145
|
-
break;
|
146
116
|
default:
|
147
117
|
throw Types.Error.InvalidJSON;
|
148
118
|
}
|
@@ -3,8 +3,7 @@ export declare enum WalletType {
|
|
3
3
|
Mnemonic = "mnemonic",
|
4
4
|
PrivateKey = "privateKey",
|
5
5
|
WatchOnly = "watchOnly",
|
6
|
-
Hardware = "hardware"
|
7
|
-
TonMnemonic = "ton-mnemonic"
|
6
|
+
Hardware = "hardware"
|
8
7
|
}
|
9
8
|
export declare enum Error {
|
10
9
|
WalletNotFound = "wallet not found",
|
@@ -35,7 +34,6 @@ export interface IKeyStore {
|
|
35
34
|
import(mnemonic: string, name: string, password: string, coins: CoinType[], encryption: StoredKeyEncryption): Promise<Wallet>;
|
36
35
|
importKey(key: Uint8Array, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Wallet>;
|
37
36
|
importWallet(wallet: Wallet): Promise<void>;
|
38
|
-
importTON(tonMnemonic: string, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Wallet>;
|
39
37
|
addAccounts(id: string, password: string, coins: CoinType[]): Promise<Wallet>;
|
40
38
|
getKey(id: string, password: string, account: ActiveAccount): Promise<PrivateKey>;
|
41
39
|
delete(id: string, password: string): Promise<void>;
|
@@ -10,7 +10,6 @@ var WalletType;
|
|
10
10
|
WalletType["PrivateKey"] = "privateKey";
|
11
11
|
WalletType["WatchOnly"] = "watchOnly";
|
12
12
|
WalletType["Hardware"] = "hardware";
|
13
|
-
WalletType["TonMnemonic"] = "ton-mnemonic";
|
14
13
|
})(WalletType = exports.WalletType || (exports.WalletType = {}));
|
15
14
|
var Error;
|
16
15
|
(function (Error) {
|
@@ -928,8 +928,6 @@ export class StoredKey {
|
|
928
928
|
static importPrivateKeyWithEncryption(privateKey: Uint8Array | Buffer, name: string, password: Uint8Array | Buffer, coin: CoinType, encryption: StoredKeyEncryption): StoredKey;
|
929
929
|
static importHDWallet(mnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType): StoredKey;
|
930
930
|
static importHDWalletWithEncryption(mnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType, encryption: StoredKeyEncryption): StoredKey;
|
931
|
-
static importTONWallet(tonMnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType): StoredKey;
|
932
|
-
static importTONWalletWithEncryption(tonMnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType, encryption: StoredKeyEncryption): StoredKey;
|
933
931
|
static importJSON(json: Uint8Array | Buffer): StoredKey;
|
934
932
|
static createLevel(name: string, password: Uint8Array | Buffer, encryptionLevel: StoredKeyEncryptionLevel): StoredKey;
|
935
933
|
static createLevelAndEncryption(name: string, password: Uint8Array | Buffer, encryptionLevel: StoredKeyEncryptionLevel, encryption: StoredKeyEncryption): StoredKey;
|
@@ -938,7 +936,6 @@ export class StoredKey {
|
|
938
936
|
identifier(): string;
|
939
937
|
name(): string;
|
940
938
|
isMnemonic(): boolean;
|
941
|
-
isTONMnemonic(): boolean;
|
942
939
|
accountCount(): number;
|
943
940
|
encryptionParameters(): string;
|
944
941
|
account(index: number): Account;
|
@@ -952,7 +949,6 @@ export class StoredKey {
|
|
952
949
|
store(path: string): boolean;
|
953
950
|
decryptPrivateKey(password: Uint8Array | Buffer): Uint8Array;
|
954
951
|
decryptMnemonic(password: Uint8Array | Buffer): string;
|
955
|
-
decryptTONMnemonic(password: Uint8Array | Buffer): string;
|
956
952
|
privateKey(coin: CoinType, password: Uint8Array | Buffer): PrivateKey;
|
957
953
|
wallet(password: Uint8Array | Buffer): HDWallet;
|
958
954
|
exportJSON(): Uint8Array;
|
@@ -986,11 +982,7 @@ export class TONMessageSigner {
|
|
986
982
|
static signMessage(privateKey: PrivateKey, message: string): string;
|
987
983
|
}
|
988
984
|
export class TONWallet {
|
989
|
-
static isValidMnemonic(mnemonic: string, passphrase: string): boolean;
|
990
985
|
static buildV4R2StateInit(publicKey: PublicKey, workchain: number, walletId: number): string;
|
991
|
-
static createWithMnemonic(mnemonic: string, passphrase: string): TONWallet;
|
992
|
-
getKey(): PrivateKey;
|
993
|
-
delete(): void;
|
994
986
|
}
|
995
987
|
export class TezosMessageSigner {
|
996
988
|
static formatMessage(message: string, url: string): string;
|