@trustwallet/wallet-core 2.9.8 → 3.0.0
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/README.md +7 -0
- package/dist/generated/core_proto.d.ts +86 -1
- package/dist/generated/core_proto.js +235 -2
- package/dist/index.js +6 -16
- package/dist/lib/wallet-core.d.ts +19 -6
- package/dist/lib/wallet-core.js +2 -2
- package/dist/lib/wallet-core.wasm +0 -0
- package/package.json +1 -1
package/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Trust Wallet Core is an open source, cross platform and cross blockchain library, it adds beta support for WebAssembly recently, You can try it out now:
|
2
|
+
|
3
|
+
```js
|
4
|
+
npm install @trustwallet/wallet-core
|
5
|
+
```
|
6
|
+
|
7
|
+
Documentation will be added to [developer.trustwallet.com](https://developer.trustwallet.com/wallet-core) later, please check out [tests](https://github.com/trustwallet/wallet-core/tree/master/wasm/tests) here for API usages.
|
@@ -5505,6 +5505,9 @@ export namespace TW {
|
|
5505
5505
|
|
5506
5506
|
/** Message wasmExecuteContractGeneric */
|
5507
5507
|
wasmExecuteContractGeneric?: (TW.Cosmos.Proto.Message.IWasmExecuteContractGeneric|null);
|
5508
|
+
|
5509
|
+
/** Message signDirectMessage */
|
5510
|
+
signDirectMessage?: (TW.Cosmos.Proto.Message.ISignDirect|null);
|
5508
5511
|
}
|
5509
5512
|
|
5510
5513
|
/** Represents a Message. */
|
@@ -5558,8 +5561,11 @@ export namespace TW {
|
|
5558
5561
|
/** Message wasmExecuteContractGeneric. */
|
5559
5562
|
public wasmExecuteContractGeneric?: (TW.Cosmos.Proto.Message.IWasmExecuteContractGeneric|null);
|
5560
5563
|
|
5564
|
+
/** Message signDirectMessage. */
|
5565
|
+
public signDirectMessage?: (TW.Cosmos.Proto.Message.ISignDirect|null);
|
5566
|
+
|
5561
5567
|
/** Message messageOneof. */
|
5562
|
-
public messageOneof?: ("sendCoinsMessage"|"transferTokensMessage"|"stakeMessage"|"unstakeMessage"|"restakeMessage"|"withdrawStakeRewardMessage"|"rawJsonMessage"|"wasmTerraExecuteContractTransferMessage"|"wasmTerraExecuteContractSendMessage"|"thorchainSendMessage"|"wasmTerraExecuteContractGeneric"|"wasmExecuteContractTransferMessage"|"wasmExecuteContractSendMessage"|"wasmExecuteContractGeneric");
|
5568
|
+
public messageOneof?: ("sendCoinsMessage"|"transferTokensMessage"|"stakeMessage"|"unstakeMessage"|"restakeMessage"|"withdrawStakeRewardMessage"|"rawJsonMessage"|"wasmTerraExecuteContractTransferMessage"|"wasmTerraExecuteContractSendMessage"|"thorchainSendMessage"|"wasmTerraExecuteContractGeneric"|"wasmExecuteContractTransferMessage"|"wasmExecuteContractSendMessage"|"wasmExecuteContractGeneric"|"signDirectMessage");
|
5563
5569
|
|
5564
5570
|
/**
|
5565
5571
|
* Creates a new Message instance using the specified properties.
|
@@ -6914,6 +6920,85 @@ export namespace TW {
|
|
6914
6920
|
*/
|
6915
6921
|
public toJSON(): { [k: string]: any };
|
6916
6922
|
}
|
6923
|
+
|
6924
|
+
/** Properties of a SignDirect. */
|
6925
|
+
interface ISignDirect {
|
6926
|
+
|
6927
|
+
/** SignDirect bodyBytes */
|
6928
|
+
bodyBytes?: (Uint8Array|null);
|
6929
|
+
|
6930
|
+
/** SignDirect authInfoBytes */
|
6931
|
+
authInfoBytes?: (Uint8Array|null);
|
6932
|
+
}
|
6933
|
+
|
6934
|
+
/** Represents a SignDirect. */
|
6935
|
+
class SignDirect implements ISignDirect {
|
6936
|
+
|
6937
|
+
/**
|
6938
|
+
* Constructs a new SignDirect.
|
6939
|
+
* @param [properties] Properties to set
|
6940
|
+
*/
|
6941
|
+
constructor(properties?: TW.Cosmos.Proto.Message.ISignDirect);
|
6942
|
+
|
6943
|
+
/** SignDirect bodyBytes. */
|
6944
|
+
public bodyBytes: Uint8Array;
|
6945
|
+
|
6946
|
+
/** SignDirect authInfoBytes. */
|
6947
|
+
public authInfoBytes: Uint8Array;
|
6948
|
+
|
6949
|
+
/**
|
6950
|
+
* Creates a new SignDirect instance using the specified properties.
|
6951
|
+
* @param [properties] Properties to set
|
6952
|
+
* @returns SignDirect instance
|
6953
|
+
*/
|
6954
|
+
public static create(properties?: TW.Cosmos.Proto.Message.ISignDirect): TW.Cosmos.Proto.Message.SignDirect;
|
6955
|
+
|
6956
|
+
/**
|
6957
|
+
* Encodes the specified SignDirect message. Does not implicitly {@link TW.Cosmos.Proto.Message.SignDirect.verify|verify} messages.
|
6958
|
+
* @param message SignDirect message or plain object to encode
|
6959
|
+
* @param [writer] Writer to encode to
|
6960
|
+
* @returns Writer
|
6961
|
+
*/
|
6962
|
+
public static encode(message: TW.Cosmos.Proto.Message.ISignDirect, writer?: $protobuf.Writer): $protobuf.Writer;
|
6963
|
+
|
6964
|
+
/**
|
6965
|
+
* Decodes a SignDirect message from the specified reader or buffer.
|
6966
|
+
* @param reader Reader or buffer to decode from
|
6967
|
+
* @param [length] Message length if known beforehand
|
6968
|
+
* @returns SignDirect
|
6969
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
6970
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
6971
|
+
*/
|
6972
|
+
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TW.Cosmos.Proto.Message.SignDirect;
|
6973
|
+
|
6974
|
+
/**
|
6975
|
+
* Verifies a SignDirect message.
|
6976
|
+
* @param message Plain object to verify
|
6977
|
+
* @returns `null` if valid, otherwise the reason why it is not
|
6978
|
+
*/
|
6979
|
+
public static verify(message: { [k: string]: any }): (string|null);
|
6980
|
+
|
6981
|
+
/**
|
6982
|
+
* Creates a SignDirect message from a plain object. Also converts values to their respective internal types.
|
6983
|
+
* @param object Plain object
|
6984
|
+
* @returns SignDirect
|
6985
|
+
*/
|
6986
|
+
public static fromObject(object: { [k: string]: any }): TW.Cosmos.Proto.Message.SignDirect;
|
6987
|
+
|
6988
|
+
/**
|
6989
|
+
* Creates a plain object from a SignDirect message. Also converts values to other types if specified.
|
6990
|
+
* @param message SignDirect
|
6991
|
+
* @param [options] Conversion options
|
6992
|
+
* @returns Plain object
|
6993
|
+
*/
|
6994
|
+
public static toObject(message: TW.Cosmos.Proto.Message.SignDirect, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
6995
|
+
|
6996
|
+
/**
|
6997
|
+
* Converts this SignDirect to JSON.
|
6998
|
+
* @returns JSON object
|
6999
|
+
*/
|
7000
|
+
public toJSON(): { [k: string]: any };
|
7001
|
+
}
|
6917
7002
|
}
|
6918
7003
|
|
6919
7004
|
/** SigningMode enum. */
|
@@ -16648,6 +16648,7 @@
|
|
16648
16648
|
* @property {TW.Cosmos.Proto.Message.IWasmExecuteContractTransfer|null} [wasmExecuteContractTransferMessage] Message wasmExecuteContractTransferMessage
|
16649
16649
|
* @property {TW.Cosmos.Proto.Message.IWasmExecuteContractSend|null} [wasmExecuteContractSendMessage] Message wasmExecuteContractSendMessage
|
16650
16650
|
* @property {TW.Cosmos.Proto.Message.IWasmExecuteContractGeneric|null} [wasmExecuteContractGeneric] Message wasmExecuteContractGeneric
|
16651
|
+
* @property {TW.Cosmos.Proto.Message.ISignDirect|null} [signDirectMessage] Message signDirectMessage
|
16651
16652
|
*/
|
16652
16653
|
|
16653
16654
|
/**
|
@@ -16777,17 +16778,25 @@
|
|
16777
16778
|
*/
|
16778
16779
|
Message.prototype.wasmExecuteContractGeneric = null;
|
16779
16780
|
|
16781
|
+
/**
|
16782
|
+
* Message signDirectMessage.
|
16783
|
+
* @member {TW.Cosmos.Proto.Message.ISignDirect|null|undefined} signDirectMessage
|
16784
|
+
* @memberof TW.Cosmos.Proto.Message
|
16785
|
+
* @instance
|
16786
|
+
*/
|
16787
|
+
Message.prototype.signDirectMessage = null;
|
16788
|
+
|
16780
16789
|
// OneOf field names bound to virtual getters and setters
|
16781
16790
|
var $oneOfFields;
|
16782
16791
|
|
16783
16792
|
/**
|
16784
16793
|
* Message messageOneof.
|
16785
|
-
* @member {"sendCoinsMessage"|"transferTokensMessage"|"stakeMessage"|"unstakeMessage"|"restakeMessage"|"withdrawStakeRewardMessage"|"rawJsonMessage"|"wasmTerraExecuteContractTransferMessage"|"wasmTerraExecuteContractSendMessage"|"thorchainSendMessage"|"wasmTerraExecuteContractGeneric"|"wasmExecuteContractTransferMessage"|"wasmExecuteContractSendMessage"|"wasmExecuteContractGeneric"|undefined} messageOneof
|
16794
|
+
* @member {"sendCoinsMessage"|"transferTokensMessage"|"stakeMessage"|"unstakeMessage"|"restakeMessage"|"withdrawStakeRewardMessage"|"rawJsonMessage"|"wasmTerraExecuteContractTransferMessage"|"wasmTerraExecuteContractSendMessage"|"thorchainSendMessage"|"wasmTerraExecuteContractGeneric"|"wasmExecuteContractTransferMessage"|"wasmExecuteContractSendMessage"|"wasmExecuteContractGeneric"|"signDirectMessage"|undefined} messageOneof
|
16786
16795
|
* @memberof TW.Cosmos.Proto.Message
|
16787
16796
|
* @instance
|
16788
16797
|
*/
|
16789
16798
|
Object.defineProperty(Message.prototype, "messageOneof", {
|
16790
|
-
get: $util.oneOfGetter($oneOfFields = ["sendCoinsMessage", "transferTokensMessage", "stakeMessage", "unstakeMessage", "restakeMessage", "withdrawStakeRewardMessage", "rawJsonMessage", "wasmTerraExecuteContractTransferMessage", "wasmTerraExecuteContractSendMessage", "thorchainSendMessage", "wasmTerraExecuteContractGeneric", "wasmExecuteContractTransferMessage", "wasmExecuteContractSendMessage", "wasmExecuteContractGeneric"]),
|
16799
|
+
get: $util.oneOfGetter($oneOfFields = ["sendCoinsMessage", "transferTokensMessage", "stakeMessage", "unstakeMessage", "restakeMessage", "withdrawStakeRewardMessage", "rawJsonMessage", "wasmTerraExecuteContractTransferMessage", "wasmTerraExecuteContractSendMessage", "thorchainSendMessage", "wasmTerraExecuteContractGeneric", "wasmExecuteContractTransferMessage", "wasmExecuteContractSendMessage", "wasmExecuteContractGeneric", "signDirectMessage"]),
|
16791
16800
|
set: $util.oneOfSetter($oneOfFields)
|
16792
16801
|
});
|
16793
16802
|
|
@@ -16843,6 +16852,8 @@
|
|
16843
16852
|
$root.TW.Cosmos.Proto.Message.WasmExecuteContractSend.encode(message.wasmExecuteContractSendMessage, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();
|
16844
16853
|
if (message.wasmExecuteContractGeneric != null && Object.hasOwnProperty.call(message, "wasmExecuteContractGeneric"))
|
16845
16854
|
$root.TW.Cosmos.Proto.Message.WasmExecuteContractGeneric.encode(message.wasmExecuteContractGeneric, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();
|
16855
|
+
if (message.signDirectMessage != null && Object.hasOwnProperty.call(message, "signDirectMessage"))
|
16856
|
+
$root.TW.Cosmos.Proto.Message.SignDirect.encode(message.signDirectMessage, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();
|
16846
16857
|
return writer;
|
16847
16858
|
};
|
16848
16859
|
|
@@ -16906,6 +16917,9 @@
|
|
16906
16917
|
case 14:
|
16907
16918
|
message.wasmExecuteContractGeneric = $root.TW.Cosmos.Proto.Message.WasmExecuteContractGeneric.decode(reader, reader.uint32());
|
16908
16919
|
break;
|
16920
|
+
case 15:
|
16921
|
+
message.signDirectMessage = $root.TW.Cosmos.Proto.Message.SignDirect.decode(reader, reader.uint32());
|
16922
|
+
break;
|
16909
16923
|
default:
|
16910
16924
|
reader.skipType(tag & 7);
|
16911
16925
|
break;
|
@@ -17064,6 +17078,16 @@
|
|
17064
17078
|
return "wasmExecuteContractGeneric." + error;
|
17065
17079
|
}
|
17066
17080
|
}
|
17081
|
+
if (message.signDirectMessage != null && message.hasOwnProperty("signDirectMessage")) {
|
17082
|
+
if (properties.messageOneof === 1)
|
17083
|
+
return "messageOneof: multiple values";
|
17084
|
+
properties.messageOneof = 1;
|
17085
|
+
{
|
17086
|
+
var error = $root.TW.Cosmos.Proto.Message.SignDirect.verify(message.signDirectMessage);
|
17087
|
+
if (error)
|
17088
|
+
return "signDirectMessage." + error;
|
17089
|
+
}
|
17090
|
+
}
|
17067
17091
|
return null;
|
17068
17092
|
};
|
17069
17093
|
|
@@ -17149,6 +17173,11 @@
|
|
17149
17173
|
throw TypeError(".TW.Cosmos.Proto.Message.wasmExecuteContractGeneric: object expected");
|
17150
17174
|
message.wasmExecuteContractGeneric = $root.TW.Cosmos.Proto.Message.WasmExecuteContractGeneric.fromObject(object.wasmExecuteContractGeneric);
|
17151
17175
|
}
|
17176
|
+
if (object.signDirectMessage != null) {
|
17177
|
+
if (typeof object.signDirectMessage !== "object")
|
17178
|
+
throw TypeError(".TW.Cosmos.Proto.Message.signDirectMessage: object expected");
|
17179
|
+
message.signDirectMessage = $root.TW.Cosmos.Proto.Message.SignDirect.fromObject(object.signDirectMessage);
|
17180
|
+
}
|
17152
17181
|
return message;
|
17153
17182
|
};
|
17154
17183
|
|
@@ -17235,6 +17264,11 @@
|
|
17235
17264
|
if (options.oneofs)
|
17236
17265
|
object.messageOneof = "wasmExecuteContractGeneric";
|
17237
17266
|
}
|
17267
|
+
if (message.signDirectMessage != null && message.hasOwnProperty("signDirectMessage")) {
|
17268
|
+
object.signDirectMessage = $root.TW.Cosmos.Proto.Message.SignDirect.toObject(message.signDirectMessage, options);
|
17269
|
+
if (options.oneofs)
|
17270
|
+
object.messageOneof = "signDirectMessage";
|
17271
|
+
}
|
17238
17272
|
return object;
|
17239
17273
|
};
|
17240
17274
|
|
@@ -20702,6 +20736,205 @@
|
|
20702
20736
|
return RawJSON;
|
20703
20737
|
})();
|
20704
20738
|
|
20739
|
+
Message.SignDirect = (function() {
|
20740
|
+
|
20741
|
+
/**
|
20742
|
+
* Properties of a SignDirect.
|
20743
|
+
* @memberof TW.Cosmos.Proto.Message
|
20744
|
+
* @interface ISignDirect
|
20745
|
+
* @property {Uint8Array|null} [bodyBytes] SignDirect bodyBytes
|
20746
|
+
* @property {Uint8Array|null} [authInfoBytes] SignDirect authInfoBytes
|
20747
|
+
*/
|
20748
|
+
|
20749
|
+
/**
|
20750
|
+
* Constructs a new SignDirect.
|
20751
|
+
* @memberof TW.Cosmos.Proto.Message
|
20752
|
+
* @classdesc Represents a SignDirect.
|
20753
|
+
* @implements ISignDirect
|
20754
|
+
* @constructor
|
20755
|
+
* @param {TW.Cosmos.Proto.Message.ISignDirect=} [properties] Properties to set
|
20756
|
+
*/
|
20757
|
+
function SignDirect(properties) {
|
20758
|
+
if (properties)
|
20759
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
20760
|
+
if (properties[keys[i]] != null)
|
20761
|
+
this[keys[i]] = properties[keys[i]];
|
20762
|
+
}
|
20763
|
+
|
20764
|
+
/**
|
20765
|
+
* SignDirect bodyBytes.
|
20766
|
+
* @member {Uint8Array} bodyBytes
|
20767
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20768
|
+
* @instance
|
20769
|
+
*/
|
20770
|
+
SignDirect.prototype.bodyBytes = $util.newBuffer([]);
|
20771
|
+
|
20772
|
+
/**
|
20773
|
+
* SignDirect authInfoBytes.
|
20774
|
+
* @member {Uint8Array} authInfoBytes
|
20775
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20776
|
+
* @instance
|
20777
|
+
*/
|
20778
|
+
SignDirect.prototype.authInfoBytes = $util.newBuffer([]);
|
20779
|
+
|
20780
|
+
/**
|
20781
|
+
* Creates a new SignDirect instance using the specified properties.
|
20782
|
+
* @function create
|
20783
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20784
|
+
* @static
|
20785
|
+
* @param {TW.Cosmos.Proto.Message.ISignDirect=} [properties] Properties to set
|
20786
|
+
* @returns {TW.Cosmos.Proto.Message.SignDirect} SignDirect instance
|
20787
|
+
*/
|
20788
|
+
SignDirect.create = function create(properties) {
|
20789
|
+
return new SignDirect(properties);
|
20790
|
+
};
|
20791
|
+
|
20792
|
+
/**
|
20793
|
+
* Encodes the specified SignDirect message. Does not implicitly {@link TW.Cosmos.Proto.Message.SignDirect.verify|verify} messages.
|
20794
|
+
* @function encode
|
20795
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20796
|
+
* @static
|
20797
|
+
* @param {TW.Cosmos.Proto.Message.ISignDirect} message SignDirect message or plain object to encode
|
20798
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
20799
|
+
* @returns {$protobuf.Writer} Writer
|
20800
|
+
*/
|
20801
|
+
SignDirect.encode = function encode(message, writer) {
|
20802
|
+
if (!writer)
|
20803
|
+
writer = $Writer.create();
|
20804
|
+
if (message.bodyBytes != null && Object.hasOwnProperty.call(message, "bodyBytes"))
|
20805
|
+
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.bodyBytes);
|
20806
|
+
if (message.authInfoBytes != null && Object.hasOwnProperty.call(message, "authInfoBytes"))
|
20807
|
+
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.authInfoBytes);
|
20808
|
+
return writer;
|
20809
|
+
};
|
20810
|
+
|
20811
|
+
/**
|
20812
|
+
* Decodes a SignDirect message from the specified reader or buffer.
|
20813
|
+
* @function decode
|
20814
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20815
|
+
* @static
|
20816
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
20817
|
+
* @param {number} [length] Message length if known beforehand
|
20818
|
+
* @returns {TW.Cosmos.Proto.Message.SignDirect} SignDirect
|
20819
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
20820
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
20821
|
+
*/
|
20822
|
+
SignDirect.decode = function decode(reader, length) {
|
20823
|
+
if (!(reader instanceof $Reader))
|
20824
|
+
reader = $Reader.create(reader);
|
20825
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.Cosmos.Proto.Message.SignDirect();
|
20826
|
+
while (reader.pos < end) {
|
20827
|
+
var tag = reader.uint32();
|
20828
|
+
switch (tag >>> 3) {
|
20829
|
+
case 1:
|
20830
|
+
message.bodyBytes = reader.bytes();
|
20831
|
+
break;
|
20832
|
+
case 2:
|
20833
|
+
message.authInfoBytes = reader.bytes();
|
20834
|
+
break;
|
20835
|
+
default:
|
20836
|
+
reader.skipType(tag & 7);
|
20837
|
+
break;
|
20838
|
+
}
|
20839
|
+
}
|
20840
|
+
return message;
|
20841
|
+
};
|
20842
|
+
|
20843
|
+
/**
|
20844
|
+
* Verifies a SignDirect message.
|
20845
|
+
* @function verify
|
20846
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20847
|
+
* @static
|
20848
|
+
* @param {Object.<string,*>} message Plain object to verify
|
20849
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
20850
|
+
*/
|
20851
|
+
SignDirect.verify = function verify(message) {
|
20852
|
+
if (typeof message !== "object" || message === null)
|
20853
|
+
return "object expected";
|
20854
|
+
if (message.bodyBytes != null && message.hasOwnProperty("bodyBytes"))
|
20855
|
+
if (!(message.bodyBytes && typeof message.bodyBytes.length === "number" || $util.isString(message.bodyBytes)))
|
20856
|
+
return "bodyBytes: buffer expected";
|
20857
|
+
if (message.authInfoBytes != null && message.hasOwnProperty("authInfoBytes"))
|
20858
|
+
if (!(message.authInfoBytes && typeof message.authInfoBytes.length === "number" || $util.isString(message.authInfoBytes)))
|
20859
|
+
return "authInfoBytes: buffer expected";
|
20860
|
+
return null;
|
20861
|
+
};
|
20862
|
+
|
20863
|
+
/**
|
20864
|
+
* Creates a SignDirect message from a plain object. Also converts values to their respective internal types.
|
20865
|
+
* @function fromObject
|
20866
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20867
|
+
* @static
|
20868
|
+
* @param {Object.<string,*>} object Plain object
|
20869
|
+
* @returns {TW.Cosmos.Proto.Message.SignDirect} SignDirect
|
20870
|
+
*/
|
20871
|
+
SignDirect.fromObject = function fromObject(object) {
|
20872
|
+
if (object instanceof $root.TW.Cosmos.Proto.Message.SignDirect)
|
20873
|
+
return object;
|
20874
|
+
var message = new $root.TW.Cosmos.Proto.Message.SignDirect();
|
20875
|
+
if (object.bodyBytes != null)
|
20876
|
+
if (typeof object.bodyBytes === "string")
|
20877
|
+
$util.base64.decode(object.bodyBytes, message.bodyBytes = $util.newBuffer($util.base64.length(object.bodyBytes)), 0);
|
20878
|
+
else if (object.bodyBytes.length)
|
20879
|
+
message.bodyBytes = object.bodyBytes;
|
20880
|
+
if (object.authInfoBytes != null)
|
20881
|
+
if (typeof object.authInfoBytes === "string")
|
20882
|
+
$util.base64.decode(object.authInfoBytes, message.authInfoBytes = $util.newBuffer($util.base64.length(object.authInfoBytes)), 0);
|
20883
|
+
else if (object.authInfoBytes.length)
|
20884
|
+
message.authInfoBytes = object.authInfoBytes;
|
20885
|
+
return message;
|
20886
|
+
};
|
20887
|
+
|
20888
|
+
/**
|
20889
|
+
* Creates a plain object from a SignDirect message. Also converts values to other types if specified.
|
20890
|
+
* @function toObject
|
20891
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20892
|
+
* @static
|
20893
|
+
* @param {TW.Cosmos.Proto.Message.SignDirect} message SignDirect
|
20894
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
20895
|
+
* @returns {Object.<string,*>} Plain object
|
20896
|
+
*/
|
20897
|
+
SignDirect.toObject = function toObject(message, options) {
|
20898
|
+
if (!options)
|
20899
|
+
options = {};
|
20900
|
+
var object = {};
|
20901
|
+
if (options.defaults) {
|
20902
|
+
if (options.bytes === String)
|
20903
|
+
object.bodyBytes = "";
|
20904
|
+
else {
|
20905
|
+
object.bodyBytes = [];
|
20906
|
+
if (options.bytes !== Array)
|
20907
|
+
object.bodyBytes = $util.newBuffer(object.bodyBytes);
|
20908
|
+
}
|
20909
|
+
if (options.bytes === String)
|
20910
|
+
object.authInfoBytes = "";
|
20911
|
+
else {
|
20912
|
+
object.authInfoBytes = [];
|
20913
|
+
if (options.bytes !== Array)
|
20914
|
+
object.authInfoBytes = $util.newBuffer(object.authInfoBytes);
|
20915
|
+
}
|
20916
|
+
}
|
20917
|
+
if (message.bodyBytes != null && message.hasOwnProperty("bodyBytes"))
|
20918
|
+
object.bodyBytes = options.bytes === String ? $util.base64.encode(message.bodyBytes, 0, message.bodyBytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.bodyBytes) : message.bodyBytes;
|
20919
|
+
if (message.authInfoBytes != null && message.hasOwnProperty("authInfoBytes"))
|
20920
|
+
object.authInfoBytes = options.bytes === String ? $util.base64.encode(message.authInfoBytes, 0, message.authInfoBytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.authInfoBytes) : message.authInfoBytes;
|
20921
|
+
return object;
|
20922
|
+
};
|
20923
|
+
|
20924
|
+
/**
|
20925
|
+
* Converts this SignDirect to JSON.
|
20926
|
+
* @function toJSON
|
20927
|
+
* @memberof TW.Cosmos.Proto.Message.SignDirect
|
20928
|
+
* @instance
|
20929
|
+
* @returns {Object.<string,*>} JSON object
|
20930
|
+
*/
|
20931
|
+
SignDirect.prototype.toJSON = function toJSON() {
|
20932
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
20933
|
+
};
|
20934
|
+
|
20935
|
+
return SignDirect;
|
20936
|
+
})();
|
20937
|
+
|
20705
20938
|
return Message;
|
20706
20939
|
})();
|
20707
20940
|
|
package/dist/index.js
CHANGED
@@ -1,21 +1,11 @@
|
|
1
|
+
"use strict";
|
1
2
|
// Copyright © 2017-2022 Trust Wallet.
|
2
3
|
//
|
3
4
|
// This file is part of Trust. The full Trust copyright notice, including
|
4
5
|
// terms governing use, modification, and redistribution, is contained in the
|
5
6
|
// file LICENSE at the root of the source code distribution tree.
|
6
|
-
(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else if (typeof define === "function" && define.amd) {
|
12
|
-
define(["require", "exports", "./generated/core_proto", "./lib/wallet-core"], factory);
|
13
|
-
}
|
14
|
-
})(function (require, exports) {
|
15
|
-
"use strict";
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.WalletCore = exports.TW = void 0;
|
18
|
-
var core_proto_1 = require("./generated/core_proto");
|
19
|
-
Object.defineProperty(exports, "TW", { enumerable: true, get: function () { return core_proto_1.TW; } });
|
20
|
-
exports.WalletCore = require("./lib/wallet-core");
|
21
|
-
});
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
+
exports.WalletCore = exports.TW = void 0;
|
9
|
+
var core_proto_1 = require("./generated/core_proto");
|
10
|
+
Object.defineProperty(exports, "TW", { enumerable: true, get: function () { return core_proto_1.TW; } });
|
11
|
+
exports.WalletCore = require("./lib/wallet-core");
|
@@ -130,6 +130,7 @@ export class CoinType {
|
|
130
130
|
static kavaEvm: CoinType;
|
131
131
|
static klaytn: CoinType;
|
132
132
|
static meter: CoinType;
|
133
|
+
static okxchain: CoinType;
|
133
134
|
}
|
134
135
|
export class Cardano {
|
135
136
|
static minAdaAmount(tokenBundle: Uint8Array | Buffer): number;
|
@@ -223,14 +224,19 @@ export class PrivateKey {
|
|
223
224
|
getPublicKeyNist256p1(): PublicKey;
|
224
225
|
getPublicKeyEd25519(): PublicKey;
|
225
226
|
getPublicKeyEd25519Blake2b(): PublicKey;
|
226
|
-
|
227
|
+
getPublicKeyEd25519Cardano(): PublicKey;
|
227
228
|
getPublicKeyCurve25519(): PublicKey;
|
228
229
|
getSharedKey(publicKey: PublicKey, curve: Curve): Uint8Array;
|
229
230
|
sign(digest: Uint8Array | Buffer, curve: Curve): Uint8Array;
|
230
|
-
signAsDER(digest: Uint8Array | Buffer
|
231
|
-
|
231
|
+
signAsDER(digest: Uint8Array | Buffer): Uint8Array;
|
232
|
+
signZilliqaSchnorr(message: Uint8Array | Buffer): Uint8Array;
|
232
233
|
delete(): void;
|
233
234
|
}
|
235
|
+
export class PrivateKeyType {
|
236
|
+
value: number;
|
237
|
+
static default: PrivateKeyType;
|
238
|
+
static cardano: PrivateKeyType;
|
239
|
+
}
|
234
240
|
export class DataVector {
|
235
241
|
static create(): DataVector;
|
236
242
|
static createWithData(data: Uint8Array | Buffer): DataVector;
|
@@ -257,6 +263,12 @@ export class HDVersion {
|
|
257
263
|
static dgub: HDVersion;
|
258
264
|
static dgpv: HDVersion;
|
259
265
|
}
|
266
|
+
export class Base64 {
|
267
|
+
static decode(string: string): Uint8Array;
|
268
|
+
static decodeUrl(string: string): Uint8Array;
|
269
|
+
static encode(data: Uint8Array | Buffer): string;
|
270
|
+
static encodeUrl(data: Uint8Array | Buffer): string;
|
271
|
+
}
|
260
272
|
export class Base32 {
|
261
273
|
static decodeWithAlphabet(string: string, alphabet: string): Uint8Array;
|
262
274
|
static decode(string: string): Uint8Array;
|
@@ -432,7 +444,7 @@ export class Curve {
|
|
432
444
|
static ed25519Blake2bNano: Curve;
|
433
445
|
static curve25519: Curve;
|
434
446
|
static nist256p1: Curve;
|
435
|
-
static
|
447
|
+
static ed25519ExtendedCardano: Curve;
|
436
448
|
}
|
437
449
|
|
438
450
|
declare function describeCurve(value: Curve): string;
|
@@ -491,7 +503,7 @@ export class PublicKeyType {
|
|
491
503
|
static ed25519: PublicKeyType;
|
492
504
|
static ed25519Blake2b: PublicKeyType;
|
493
505
|
static curve25519: PublicKeyType;
|
494
|
-
static
|
506
|
+
static ed25519Cardano: PublicKeyType;
|
495
507
|
}
|
496
508
|
export class BitcoinSigHashType {
|
497
509
|
value: number;
|
@@ -510,6 +522,7 @@ export class EthereumChainID {
|
|
510
522
|
static callisto: EthereumChainID;
|
511
523
|
static tomochain: EthereumChainID;
|
512
524
|
static polygon: EthereumChainID;
|
525
|
+
static okc: EthereumChainID;
|
513
526
|
static thundertoken: EthereumChainID;
|
514
527
|
static gochain: EthereumChainID;
|
515
528
|
static meter: EthereumChainID;
|
@@ -647,6 +660,6 @@ export class PublicKey {
|
|
647
660
|
description(): string;
|
648
661
|
verify(signature: Uint8Array | Buffer, message: Uint8Array | Buffer): boolean;
|
649
662
|
verifyAsDER(signature: Uint8Array | Buffer, message: Uint8Array | Buffer): boolean;
|
650
|
-
|
663
|
+
verifyZilliqaSchnorr(signature: Uint8Array | Buffer, message: Uint8Array | Buffer): boolean;
|
651
664
|
delete(): void;
|
652
665
|
}
|
package/dist/lib/wallet-core.js
CHANGED
@@ -85,14 +85,14 @@ readValueFromPointer:function(k){if(1===c)var l=D;else if(2===c)l=B;else if(4===
|
|
85
85
|
E)throw new Xb("Use 'new' to construct "+q);if(void 0===da.Ia)throw new Xb(q+" has no accessible constructor");var Cc=da.Ia[arguments.length];if(void 0===Cc)throw new Xb("Tried to invoke ctor of "+q+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(da.Ia).toString()+") parameters instead!");return Cc.apply(this,arguments)});var E=Object.create(A,{constructor:{value:r}});r.prototype=E;var da=new pc(q,r,E,v,w,f,l,p);w=new W(q,da,!0,!1);A=new W(q+"*",da,!1,!1);var Dc=
|
86
86
|
new W(q+" const*",da,!1,!0);fc[a]={pointerType:A,vb:Dc};xc(h,r);return[w,A,Dc]})},f:function(a,b,c,d,e,f,k){var l=Ic(c,d);b=R(b);f=X(e,f);$b([],[a],function(m){function p(){Ec("Cannot call "+q+" due to unbound types",l)}m=m[0];var q=m.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var t=m.wa.constructor;void 0===t[b]?(p.Pa=c-1,t[b]=p):(nc(t,b,q),t[b].za[c-1]=p);$b([],l,function(v){v=[v[0],null].concat(v.slice(1));v=Hc(q,v,null,f,k);void 0===t[b].za?(v.Pa=c-1,t[b]=v):t[b].za[c-1]=v;return[]});
|
87
87
|
return[]})},e:function(a,b,c,d,e,f,k,l){var m=Ic(c,d);b=R(b);f=X(e,f);$b([],[a],function(p){function q(){Ec("Cannot call "+t+" due to unbound types",m)}p=p[0];var t=p.name+"."+b;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);l&&p.wa.Fb.push(b);var v=p.wa.Ra,h=v[b];void 0===h||void 0===h.za&&h.className!==p.name&&h.Pa===c-2?(q.Pa=c-2,q.className=p.name,v[b]=q):(nc(v,b,t),v[b].za[c-2]=q);$b([],m,function(r){r=Hc(t,r,p,f,k);void 0===v[b].za?(r.Pa=c-2,v[b]=r):v[b].za[c-2]=r;return[]});return[]})},M:function(a,
|
88
|
-
b){b=R(b);U(a,{name:b,fromWireType:function(c){var d=Lc(c);Kc(c);return d},toWireType:function(c,d){return uc(d)},argPackAdvance:8,readValueFromPointer:wc,Da:null})},
|
88
|
+
b){b=R(b);U(a,{name:b,fromWireType:function(c){var d=Lc(c);Kc(c);return d},toWireType:function(c,d){return uc(d)},argPackAdvance:8,readValueFromPointer:wc,Da:null})},j:function(a,b,c,d){function e(){}c=Qb(c);b=R(b);e.values={};U(a,{name:b,constructor:e,fromWireType:function(f){return this.constructor.values[f]},toWireType:function(f,k){return k.value},argPackAdvance:8,readValueFromPointer:Mc(b,c,d),Da:null});oc(b,e)},b:function(a,b,c){var d=Nc(a,"enum");b=R(b);a=d.constructor;d=Object.create(d.constructor.prototype,
|
89
89
|
{value:{value:c},constructor:{value:Vb(d.name+"_"+b,function(){})}});a.values[c]=d;a[b]=d},x:function(a,b,c){c=Qb(c);b=R(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){return e},argPackAdvance:8,readValueFromPointer:Oc(b,c),Da:null})},q:function(a,b,c,d,e,f){var k=Ic(b,c);a=R(a);e=X(d,e);oc(a,function(){Ec("Cannot call "+a+" due to unbound types",k)},b-1);$b([],k,function(l){l=[l[0],null].concat(l.slice(1));xc(a,Hc(a,l,null,e,f),b-1);return[]})},l:function(a,b,c,d,e){b=
|
90
90
|
R(b);-1===e&&(e=4294967295);e=Qb(c);var f=l=>l;if(0===d){var k=32-8*c;f=l=>l<<k>>>k}c=b.includes("unsigned")?function(l,m){return m>>>0}:function(l,m){return m};U(a,{name:b,fromWireType:f,toWireType:c,argPackAdvance:8,readValueFromPointer:Pc(b,e,0!==d),Da:null})},i:function(a,b,c){function d(f){f>>=2;var k=F;return new e(Ca,k[f+1],k[f])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=R(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},
|
91
91
|
{zb:!0})},w:function(a,b){b=R(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var e=F[d>>2];if(c)for(var f=d+4,k=0;k<=e;++k){var l=d+4+k;if(k==e||0==z[l]){f=y(f,l-f);if(void 0===m)var m=f;else m+=String.fromCharCode(0),m+=f;f=l+1}}else{m=Array(e);for(k=0;k<e;++k)m[k]=String.fromCharCode(z[d+4+k]);m=m.join("")}Y(d);return m},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var f="string"==typeof e;f||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof
|
92
92
|
Int8Array||T("Cannot pass non-string to std::string");var k=(c&&f?()=>ta(e):()=>e.length)(),l=hd(4+k+1);F[l>>2]=k;if(c&&f)sa(e,z,l+4,k+1);else if(f)for(f=0;f<k;++f){var m=e.charCodeAt(f);255<m&&(Y(l),T("String has UTF-16 code units that do not fit in 8 bits"));z[l+4+f]=m}else for(f=0;f<k;++f)z[l+4+f]=e[f];null!==d&&d.push(Y,l);return l},argPackAdvance:8,readValueFromPointer:wc,Da:function(d){Y(d)}})},p:function(a,b,c){c=R(c);if(2===b){var d=va;var e=xa;var f=ya;var k=()=>wa;var l=1}else 4===b&&(d=
|
93
93
|
za,e=Aa,f=Ba,k=()=>F,l=2);U(a,{name:c,fromWireType:function(m){for(var p=F[m>>2],q=k(),t,v=m+4,h=0;h<=p;++h){var r=m+4+h*b;if(h==p||0==q[r>>l])v=d(v,r-v),void 0===t?t=v:(t+=String.fromCharCode(0),t+=v),v=r+b}Y(m);return t},toWireType:function(m,p){"string"!=typeof p&&T("Cannot pass non-string to C++ string type "+c);var q=f(p),t=hd(4+q+b);F[t>>2]=q>>l;e(p,t+4,q+b);null!==m&&m.push(Y,t);return t},argPackAdvance:8,readValueFromPointer:wc,Da:function(m){Y(m)}})},O:function(a,b){b=R(b);U(a,{Bb:!0,name:b,
|
94
94
|
argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},v:function(){return Date.now()},K:function(){return!0},P:function(a,b,c,d){a=Sc[a];b=Lc(b);c=Rc(c);a(b,c,null,d)},h:Kc,z:function(a){if(0===a)return uc(Tc());a=Rc(a);return uc(Tc()[a])},Q:function(a,b){var c=Vc(a,b),d=c[0];b=d.name+"_$"+c.slice(1).map(function(q){return q.name}).join("_")+"$";var e=Wc[b];if(void 0!==e)return e;e=["retType"];for(var f=[d],k="",l=0;l<a-1;++l)k+=(0!==l?", ":"")+"arg"+l,e.push("argType"+l),f.push(c[1+
|
95
|
-
l]);var m="return function "+Ub("methodCaller_"+b)+"(handle, name, destructors, args) {\n",p=0;for(l=0;l<a-1;++l)m+=" var arg"+l+" = argType"+l+".readValueFromPointer(args"+(p?"+"+p:"")+");\n",p+=c[l+1].argPackAdvance;m+=" var rv = handle[name]("+k+");\n";for(l=0;l<a-1;++l)c[l+1].deleteObject&&(m+=" argType"+l+".deleteObject(arg"+l+");\n");d.Bb||(m+=" return retType.toWireType(destructors, rv);\n");e.push(m+"};\n");a=Fc(e).apply(null,f);e=Uc(a);return Wc[b]=e},
|
95
|
+
l]);var m="return function "+Ub("methodCaller_"+b)+"(handle, name, destructors, args) {\n",p=0;for(l=0;l<a-1;++l)m+=" var arg"+l+" = argType"+l+".readValueFromPointer(args"+(p?"+"+p:"")+");\n",p+=c[l+1].argPackAdvance;m+=" var rv = handle[name]("+k+");\n";for(l=0;l<a-1;++l)c[l+1].deleteObject&&(m+=" argType"+l+".deleteObject(arg"+l+");\n");d.Bb||(m+=" return retType.toWireType(destructors, rv);\n");e.push(m+"};\n");a=Fc(e).apply(null,f);e=Uc(a);return Wc[b]=e},k:function(a){4<a&&(Z[a].hb+=
|
96
96
|
1)},y:function(a,b,c,d){a=Lc(a);var e=Xc[b];if(!e){e="";for(var f=0;f<b;++f)e+=(0!==f?", ":"")+"arg"+f;var k="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(f=0;f<b;++f)k+="var argType"+f+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+f+'], "parameter '+f+'");\nvar arg'+f+" = argType"+f+".readValueFromPointer(args);\nargs += argType"+f+"['argPackAdvance'];\n";e=(new Function("requireRegisteredType","Module","valueToHandle",k+("var obj = new constructor("+
|
97
97
|
e+");\nreturn valueToHandle(obj);\n}\n")))(Nc,g,uc);Xc[b]=e}return e(a,c,d)},A:function(a,b){a=Nc(a,"_emval_take_value");a=a.readValueFromPointer(b);return uc(a)},J:function(a,b,c,d,e,f){try{var k=L[e];if(k&&c&2){var l=z.slice(a,a+b);k&&k.sa.Za&&k.sa.Za(k,l,f,b,d)}}catch(m){if("undefined"==typeof O||!(m instanceof J))throw m;return-m.Ja}},n:function(){x("")},L:function(a,b,c){z.copyWithin(a,b,b+c)},I:function(a){var b=z.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);
|
98
98
|
d=Math.min(d,a+100663296);var e=Math;d=Math.max(a,d);e=e.min.call(e,2147483648,d+(65536-d%65536)%65536);a:{try{oa.grow(e-Ca.byteLength+65535>>>16);Fa();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},F:function(a,b){var c=0;Zc().forEach(function(d,e){var f=b+c;e=F[a+4*e>>2]=f;for(f=0;f<d.length;++f)D[e++>>0]=d.charCodeAt(f);D[e>>0]=0;c+=d.length+1});return 0},G:function(a,b){var c=Zc();F[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});F[b>>2]=d;return 0},o:function(a){try{var b=
|
Binary file
|