@trustwallet/wallet-core 2.9.7 → 3.0.1
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.d.ts +5 -2
- package/dist/index.js +7 -16
- package/dist/lib/wallet-core.js +181 -110
- package/dist/lib/wallet-core.wasm +0 -0
- package/dist/{lib/wallet-core.d.ts → wallet-core.d.ts} +475 -408
- package/package.json +3 -2
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.d.ts
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { TW } from "./generated/core_proto";
|
2
|
+
import { WalletCore } from "./wallet-core";
|
3
|
+
declare function load(): Promise<WalletCore>;
|
4
|
+
export declare const initWasm: typeof load;
|
5
|
+
export { TW, WalletCore };
|
package/dist/index.js
CHANGED
@@ -1,21 +1,12 @@
|
|
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
|
-
|
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.TW = exports.initWasm = void 0;
|
9
|
+
var Loader = require("./lib/wallet-core");
|
10
|
+
var core_proto_1 = require("./generated/core_proto");
|
11
|
+
Object.defineProperty(exports, "TW", { enumerable: true, get: function () { return core_proto_1.TW; } });
|
12
|
+
exports.initWasm = Loader;
|