@injectivelabs/sdk-ts 1.10.73-beta.4 → 1.10.73-beta.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.
@@ -1,4 +1,5 @@
1
1
  export * from './modules';
2
2
  export * from './accounts';
3
3
  export * from './utils';
4
+ export * as Stargate from './stargate';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA"}
@@ -10,11 +10,25 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
16
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Stargate = void 0;
17
30
  __exportStar(require("./modules"), exports);
18
31
  __exportStar(require("./accounts"), exports);
19
32
  __exportStar(require("./utils"), exports);
33
+ exports.Stargate = __importStar(require("./stargate"));
20
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B;AAC1B,0CAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B;AAC1B,0CAAuB;AACvB,uDAAsC"}
@@ -0,0 +1,82 @@
1
+ import { StdFee } from '@cosmjs/amino';
2
+ import { EncodeObject, OfflineSigner, Registry } from '@cosmjs/proto-signing';
3
+ import { HttpEndpoint, TendermintClient } from '@cosmjs/tendermint-rpc';
4
+ import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin';
5
+ import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
6
+ import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
7
+ import { AminoConverters, AminoTypes } from '@cosmjs/stargate';
8
+ import { GasPrice } from '@cosmjs/stargate';
9
+ import { DeliverTxResponse, StargateClientOptions } from '@cosmjs/stargate';
10
+ import { StargateClient } from './StargateClient';
11
+ /**
12
+ * Signing information for a single signer that is not included in the transaction.
13
+ *
14
+ * @see https://github.com/cosmos/cosmos-sdk/blob/v0.42.2/x/auth/signing/sign_mode_handler.go#L23-L37
15
+ */
16
+ export interface SignerData {
17
+ readonly accountNumber: number;
18
+ readonly sequence: number;
19
+ readonly chainId: string;
20
+ }
21
+ export interface SigningStargateClientOptions extends StargateClientOptions {
22
+ readonly registry?: Registry;
23
+ readonly aminoTypes?: AminoTypes;
24
+ readonly broadcastTimeoutMs?: number;
25
+ readonly broadcastPollIntervalMs?: number;
26
+ readonly gasPrice?: GasPrice;
27
+ }
28
+ export declare function createDefaultAminoConverters(): AminoConverters;
29
+ export declare class SigningStargateClient extends StargateClient {
30
+ readonly registry: Registry;
31
+ readonly broadcastTimeoutMs: number | undefined;
32
+ readonly broadcastPollIntervalMs: number | undefined;
33
+ protected readonly signer: OfflineSigner;
34
+ protected readonly aminoTypes: AminoTypes;
35
+ protected readonly gasPrice: GasPrice | undefined;
36
+ /**
37
+ * Creates an instance by connecting to the given Tendermint RPC endpoint.
38
+ *
39
+ * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
40
+ * support, see `createWithSigner`.
41
+ */
42
+ static connectWithSigner(endpoint: string | HttpEndpoint, signer: OfflineSigner, options?: SigningStargateClientOptions): Promise<SigningStargateClient>;
43
+ /**
44
+ * Creates an instance from a manually created Tendermint client.
45
+ * Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
46
+ */
47
+ static createWithSigner(tmClient: TendermintClient, signer: OfflineSigner, options?: SigningStargateClientOptions): Promise<SigningStargateClient>;
48
+ /**
49
+ * Creates a client in offline mode.
50
+ *
51
+ * This should only be used in niche cases where you know exactly what you're doing,
52
+ * e.g. when building an offline signing application.
53
+ *
54
+ * When you try to use online functionality with such a signer, an
55
+ * exception will be raised.
56
+ */
57
+ static offline(signer: OfflineSigner, options?: SigningStargateClientOptions): Promise<SigningStargateClient>;
58
+ protected constructor(tmClient: TendermintClient | undefined, signer: OfflineSigner, options: SigningStargateClientOptions);
59
+ simulate(signerAddress: string, messages: readonly EncodeObject[], memo: string | undefined): Promise<number>;
60
+ sendTokens(senderAddress: string, recipientAddress: string, amount: readonly Coin[], fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
61
+ delegateTokens(delegatorAddress: string, validatorAddress: string, amount: Coin, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
62
+ undelegateTokens(delegatorAddress: string, validatorAddress: string, amount: Coin, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
63
+ withdrawRewards(delegatorAddress: string, validatorAddress: string, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
64
+ sendIbcTokens(senderAddress: string, recipientAddress: string, transferAmount: Coin, sourcePort: string, sourceChannel: string, timeoutHeight: Height | undefined,
65
+ /** timeout in seconds */
66
+ timeoutTimestamp: number | undefined, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
67
+ signAndBroadcast(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
68
+ /**
69
+ * Gets account number and sequence from the API, creates a sign doc,
70
+ * creates a single signature and assembles the signed transaction.
71
+ *
72
+ * The sign mode (SIGN_MODE_DIRECT or SIGN_MODE_LEGACY_AMINO_JSON) is determined by this client's signer.
73
+ *
74
+ * You can pass signer data (account number, sequence and chain ID) explicitly instead of querying them
75
+ * from the chain. This is needed when signing for a multisig account, but it also allows for offline signing
76
+ * (See the SigningStargateClient.offline constructor).
77
+ */
78
+ sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData): Promise<TxRaw>;
79
+ protected signAmino(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, { accountNumber, sequence, chainId }: SignerData): Promise<TxRaw>;
80
+ protected signDirect(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, { accountNumber, sequence, chainId }: SignerData): Promise<TxRaw>;
81
+ }
82
+ //# sourceMappingURL=SigningStargateClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SigningStargateClient.d.ts","sourceRoot":"","sources":["../../../../src/core/stargate/SigningStargateClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACP,MAAM,eAAe,CAAA;AAGtB,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,QAAQ,EAET,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,YAAY,EAEZ,gBAAgB,EACjB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,IAAI,EAA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,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,UAAU,GAC/C,OAAO,CAAC,KAAK,CAAC;CAkDlB"}
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SigningStargateClient = exports.createDefaultAminoConverters = void 0;
16
+ const amino_1 = require("@cosmjs/amino");
17
+ const encoding_1 = require("@cosmjs/encoding");
18
+ const math_1 = require("@cosmjs/math");
19
+ const proto_signing_1 = require("@cosmjs/proto-signing");
20
+ const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
21
+ const utils_1 = require("@cosmjs/utils");
22
+ const tx_1 = require("cosmjs-types/cosmos/distribution/v1beta1/tx");
23
+ const tx_2 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
24
+ const signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
25
+ const tx_3 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
26
+ const tx_4 = require("cosmjs-types/ibc/applications/transfer/v1/tx");
27
+ const long_1 = __importDefault(require("long"));
28
+ const stargate_1 = require("@cosmjs/stargate");
29
+ const stargate_2 = require("@cosmjs/stargate");
30
+ const stargate_3 = require("@cosmjs/stargate");
31
+ const stargate_4 = require("@cosmjs/stargate");
32
+ const StargateClient_1 = require("./StargateClient");
33
+ const modules_1 = require("../modules");
34
+ function createDefaultAminoConverters() {
35
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, stargate_3.createAuthzAminoConverters)()), (0, stargate_3.createBankAminoConverters)()), (0, stargate_3.createDistributionAminoConverters)()), (0, stargate_3.createGovAminoConverters)()), (0, stargate_3.createStakingAminoConverters)()), (0, stargate_3.createIbcAminoConverters)()), (0, stargate_3.createFeegrantAminoConverters)()), (0, stargate_3.createVestingAminoConverters)());
36
+ }
37
+ exports.createDefaultAminoConverters = createDefaultAminoConverters;
38
+ class SigningStargateClient extends StargateClient_1.StargateClient {
39
+ /**
40
+ * Creates an instance by connecting to the given Tendermint RPC endpoint.
41
+ *
42
+ * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
43
+ * support, see `createWithSigner`.
44
+ */
45
+ static connectWithSigner(endpoint, signer, options = {}) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const tmClient = yield tendermint_rpc_1.Tendermint34Client.connect(endpoint);
48
+ return SigningStargateClient.createWithSigner(tmClient, signer, options);
49
+ });
50
+ }
51
+ /**
52
+ * Creates an instance from a manually created Tendermint client.
53
+ * Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
54
+ */
55
+ static createWithSigner(tmClient, signer, options = {}) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ return new SigningStargateClient(tmClient, signer, options);
58
+ });
59
+ }
60
+ /**
61
+ * Creates a client in offline mode.
62
+ *
63
+ * This should only be used in niche cases where you know exactly what you're doing,
64
+ * e.g. when building an offline signing application.
65
+ *
66
+ * When you try to use online functionality with such a signer, an
67
+ * exception will be raised.
68
+ */
69
+ static offline(signer, options = {}) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return new SigningStargateClient(undefined, signer, options);
72
+ });
73
+ }
74
+ constructor(tmClient, signer, options) {
75
+ super(tmClient, options);
76
+ const { registry = new proto_signing_1.Registry(stargate_4.defaultRegistryTypes), aminoTypes = new stargate_1.AminoTypes(createDefaultAminoConverters()), } = options;
77
+ this.registry = registry;
78
+ this.aminoTypes = aminoTypes;
79
+ this.signer = signer;
80
+ this.broadcastTimeoutMs = options.broadcastTimeoutMs;
81
+ this.broadcastPollIntervalMs = options.broadcastPollIntervalMs;
82
+ this.gasPrice = options.gasPrice;
83
+ }
84
+ simulate(signerAddress, messages, memo) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ const anyMsgs = messages.map((m) => this.registry.encodeAsAny(m));
87
+ const accountFromSigner = (yield this.signer.getAccounts()).find((account) => account.address === signerAddress);
88
+ if (!accountFromSigner) {
89
+ throw new Error('Failed to retrieve account from signer');
90
+ }
91
+ const pubkey = (0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey);
92
+ const { sequence } = yield this.getSequence(signerAddress);
93
+ const { gasInfo } = yield this.forceGetQueryClient().tx.simulate(anyMsgs, memo, pubkey, sequence);
94
+ (0, utils_1.assertDefined)(gasInfo);
95
+ return math_1.Uint53.fromString(gasInfo.gasUsed.toString()).toNumber();
96
+ });
97
+ }
98
+ sendTokens(senderAddress, recipientAddress, amount, fee, memo = '') {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const sendMsg = {
101
+ typeUrl: '/cosmos.bank.v1beta1.MsgSend',
102
+ value: {
103
+ fromAddress: senderAddress,
104
+ toAddress: recipientAddress,
105
+ amount: [...amount],
106
+ },
107
+ };
108
+ return this.signAndBroadcast(senderAddress, [sendMsg], fee, memo);
109
+ });
110
+ }
111
+ delegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = '') {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const delegateMsg = {
114
+ typeUrl: '/cosmos.staking.v1beta1.MsgDelegate',
115
+ value: tx_2.MsgDelegate.fromPartial({
116
+ delegatorAddress: delegatorAddress,
117
+ validatorAddress: validatorAddress,
118
+ amount: amount,
119
+ }),
120
+ };
121
+ return this.signAndBroadcast(delegatorAddress, [delegateMsg], fee, memo);
122
+ });
123
+ }
124
+ undelegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = '') {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ const undelegateMsg = {
127
+ typeUrl: '/cosmos.staking.v1beta1.MsgUndelegate',
128
+ value: tx_2.MsgUndelegate.fromPartial({
129
+ delegatorAddress: delegatorAddress,
130
+ validatorAddress: validatorAddress,
131
+ amount: amount,
132
+ }),
133
+ };
134
+ return this.signAndBroadcast(delegatorAddress, [undelegateMsg], fee, memo);
135
+ });
136
+ }
137
+ withdrawRewards(delegatorAddress, validatorAddress, fee, memo = '') {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const withdrawMsg = {
140
+ typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
141
+ value: tx_1.MsgWithdrawDelegatorReward.fromPartial({
142
+ delegatorAddress: delegatorAddress,
143
+ validatorAddress: validatorAddress,
144
+ }),
145
+ };
146
+ return this.signAndBroadcast(delegatorAddress, [withdrawMsg], fee, memo);
147
+ });
148
+ }
149
+ sendIbcTokens(senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight,
150
+ /** timeout in seconds */
151
+ timeoutTimestamp, fee, memo = '') {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ const timeoutTimestampNanoseconds = timeoutTimestamp
154
+ ? long_1.default.fromNumber(timeoutTimestamp).multiply(1000000000)
155
+ : undefined;
156
+ const transferMsg = {
157
+ typeUrl: '/ibc.applications.transfer.v1.MsgTransfer',
158
+ value: tx_4.MsgTransfer.fromPartial({
159
+ sourcePort: sourcePort,
160
+ sourceChannel: sourceChannel,
161
+ sender: senderAddress,
162
+ receiver: recipientAddress,
163
+ token: transferAmount,
164
+ timeoutHeight: timeoutHeight,
165
+ timeoutTimestamp: timeoutTimestampNanoseconds,
166
+ }),
167
+ };
168
+ return this.signAndBroadcast(senderAddress, [transferMsg], fee, memo);
169
+ });
170
+ }
171
+ signAndBroadcast(signerAddress, messages, fee, memo = '') {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ let usedFee;
174
+ if (fee == 'auto' || typeof fee === 'number') {
175
+ (0, utils_1.assertDefined)(this.gasPrice, 'Gas price must be set in the client options when auto gas is used.');
176
+ const gasEstimation = yield this.simulate(signerAddress, messages, memo);
177
+ const multiplier = typeof fee === 'number' ? fee : 1.3;
178
+ usedFee = (0, stargate_2.calculateFee)(Math.round(gasEstimation * multiplier), this.gasPrice);
179
+ }
180
+ else {
181
+ usedFee = fee;
182
+ }
183
+ const txRaw = yield this.sign(signerAddress, messages, usedFee, memo);
184
+ const txBytes = tx_3.TxRaw.encode(txRaw).finish();
185
+ return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs);
186
+ });
187
+ }
188
+ /**
189
+ * Gets account number and sequence from the API, creates a sign doc,
190
+ * creates a single signature and assembles the signed transaction.
191
+ *
192
+ * The sign mode (SIGN_MODE_DIRECT or SIGN_MODE_LEGACY_AMINO_JSON) is determined by this client's signer.
193
+ *
194
+ * You can pass signer data (account number, sequence and chain ID) explicitly instead of querying them
195
+ * from the chain. This is needed when signing for a multisig account, but it also allows for offline signing
196
+ * (See the SigningStargateClient.offline constructor).
197
+ */
198
+ sign(signerAddress, messages, fee, memo, explicitSignerData) {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ let signerData;
201
+ if (explicitSignerData) {
202
+ signerData = explicitSignerData;
203
+ }
204
+ else {
205
+ const { accountNumber, sequence } = yield this.getSequence(signerAddress);
206
+ const chainId = yield this.getChainId();
207
+ signerData = {
208
+ accountNumber: accountNumber,
209
+ sequence: sequence,
210
+ chainId: chainId,
211
+ };
212
+ }
213
+ return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
214
+ ? this.signDirect(signerAddress, messages, fee, memo, signerData)
215
+ : this.signAmino(signerAddress, messages, fee, memo, signerData);
216
+ });
217
+ }
218
+ signAmino(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
219
+ return __awaiter(this, void 0, void 0, function* () {
220
+ (0, utils_1.assert)(!(0, proto_signing_1.isOfflineDirectSigner)(this.signer));
221
+ const accountFromSigner = (yield this.signer.getAccounts()).find((account) => account.address === signerAddress);
222
+ if (!accountFromSigner) {
223
+ throw new Error('Failed to retrieve account from signer');
224
+ }
225
+ const pubkey = chainId.startsWith('injective')
226
+ ? (0, modules_1.getPublicKey)({
227
+ chainId,
228
+ key: Buffer.from(accountFromSigner.pubkey).toString('base64'),
229
+ })
230
+ : (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
231
+ const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
232
+ const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
233
+ const signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
234
+ const { signature, signed } = yield this.signer.signAmino(signerAddress, signDoc);
235
+ const signedTxBody = {
236
+ messages: signed.msgs.map((msg) => this.aminoTypes.fromAmino(msg)),
237
+ memo: signed.memo,
238
+ };
239
+ const signedTxBodyEncodeObject = {
240
+ typeUrl: '/cosmos.tx.v1beta1.TxBody',
241
+ value: signedTxBody,
242
+ };
243
+ const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
244
+ const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
245
+ const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
246
+ const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signed.fee.granter, signed.fee.payer, signMode);
247
+ return tx_3.TxRaw.fromPartial({
248
+ bodyBytes: signedTxBodyBytes,
249
+ authInfoBytes: signedAuthInfoBytes,
250
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
251
+ });
252
+ });
253
+ }
254
+ signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
255
+ return __awaiter(this, void 0, void 0, function* () {
256
+ (0, utils_1.assert)((0, proto_signing_1.isOfflineDirectSigner)(this.signer));
257
+ const accountFromSigner = (yield this.signer.getAccounts()).find((account) => account.address === signerAddress);
258
+ if (!accountFromSigner) {
259
+ throw new Error('Failed to retrieve account from signer');
260
+ }
261
+ const pubkey = chainId.startsWith('injective')
262
+ ? (0, modules_1.getPublicKey)({
263
+ chainId,
264
+ key: Buffer.from(accountFromSigner.pubkey).toString('base64'),
265
+ })
266
+ : (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
267
+ const txBodyEncodeObject = {
268
+ typeUrl: '/cosmos.tx.v1beta1.TxBody',
269
+ value: {
270
+ messages: messages,
271
+ memo: memo,
272
+ },
273
+ };
274
+ const txBodyBytes = this.registry.encode(txBodyEncodeObject);
275
+ const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
276
+ const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit, fee.granter, fee.payer);
277
+ const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
278
+ const { signature, signed } = yield this.signer.signDirect(signerAddress, signDoc);
279
+ return tx_3.TxRaw.fromPartial({
280
+ bodyBytes: signed.bodyBytes,
281
+ authInfoBytes: signed.authInfoBytes,
282
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
283
+ });
284
+ });
285
+ }
286
+ }
287
+ exports.SigningStargateClient = SigningStargateClient;
288
+ //# sourceMappingURL=SigningStargateClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SigningStargateClient.js","sourceRoot":"","sources":["../../../../src/core/stargate/SigningStargateClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAIsB;AACtB,+CAA6C;AAC7C,uCAA4C;AAC5C,yDAS8B;AAC9B,2DAI+B;AAC/B,yCAAqD;AAErD,oEAAwF;AACxF,+DAG+C;AAC/C,4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AA;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;YAC5D,MAAM,QAAQ,GAAG,YAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;YACrD,MAAM,aAAa,GAAG,IAAA,iCAAiB,EACrC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EACtB,GAAG,CAAC,MAAM,EACV,QAAQ,EACR,GAAG,CAAC,OAAO,EACX,GAAG,CAAC,KAAK,CACV,CAAA;YACD,MAAM,OAAO,GAAG,IAAA,2BAAW,EACzB,WAAW,EACX,aAAa,EACb,OAAO,EACP,aAAa,CACd,CAAA;YACD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CACxD,aAAa,EACb,OAAO,CACR,CAAA;YACD,OAAO,UAAK,CAAC,WAAW,CAAC;gBACvB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,UAAU,EAAE,CAAC,IAAA,qBAAU,EAAC,SAAS,CAAC,SAAS,CAAC,CAAC;aAC9C,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AA1XD,sDA0XC"}
@@ -1,2 +1,3 @@
1
1
  export { StargateClient as InjectiveStargateClient } from './StargateClient';
2
+ export { SigningStargateClient as InjectiveSigningStargateClient } from './SigningStargateClient';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,qBAAqB,IAAI,8BAA8B,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InjectiveStargateClient = void 0;
3
+ exports.InjectiveSigningStargateClient = exports.InjectiveStargateClient = void 0;
4
4
  var StargateClient_1 = require("./StargateClient");
5
5
  Object.defineProperty(exports, "InjectiveStargateClient", { enumerable: true, get: function () { return StargateClient_1.StargateClient; } });
6
+ var SigningStargateClient_1 = require("./SigningStargateClient");
7
+ Object.defineProperty(exports, "InjectiveSigningStargateClient", { enumerable: true, get: function () { return SigningStargateClient_1.SigningStargateClient; } });
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":";;;AAAA,mDAA4E;AAAnE,yHAAA,cAAc,OAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":";;;AAAA,mDAA4E;AAAnE,yHAAA,cAAc,OAA2B;AAClD,iEAAiG;AAAxF,uIAAA,qBAAqB,OAAkC"}
@@ -1,4 +1,5 @@
1
1
  export * from './modules';
2
2
  export * from './accounts';
3
3
  export * from './utils';
4
+ export * as Stargate from './stargate';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './modules';
2
2
  export * from './accounts';
3
3
  export * from './utils';
4
+ export * as Stargate from './stargate';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA"}
@@ -0,0 +1,82 @@
1
+ import { StdFee } from '@cosmjs/amino';
2
+ import { EncodeObject, OfflineSigner, Registry } from '@cosmjs/proto-signing';
3
+ import { HttpEndpoint, TendermintClient } from '@cosmjs/tendermint-rpc';
4
+ import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin';
5
+ import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
6
+ import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
7
+ import { AminoConverters, AminoTypes } from '@cosmjs/stargate';
8
+ import { GasPrice } from '@cosmjs/stargate';
9
+ import { DeliverTxResponse, StargateClientOptions } from '@cosmjs/stargate';
10
+ import { StargateClient } from './StargateClient';
11
+ /**
12
+ * Signing information for a single signer that is not included in the transaction.
13
+ *
14
+ * @see https://github.com/cosmos/cosmos-sdk/blob/v0.42.2/x/auth/signing/sign_mode_handler.go#L23-L37
15
+ */
16
+ export interface SignerData {
17
+ readonly accountNumber: number;
18
+ readonly sequence: number;
19
+ readonly chainId: string;
20
+ }
21
+ export interface SigningStargateClientOptions extends StargateClientOptions {
22
+ readonly registry?: Registry;
23
+ readonly aminoTypes?: AminoTypes;
24
+ readonly broadcastTimeoutMs?: number;
25
+ readonly broadcastPollIntervalMs?: number;
26
+ readonly gasPrice?: GasPrice;
27
+ }
28
+ export declare function createDefaultAminoConverters(): AminoConverters;
29
+ export declare class SigningStargateClient extends StargateClient {
30
+ readonly registry: Registry;
31
+ readonly broadcastTimeoutMs: number | undefined;
32
+ readonly broadcastPollIntervalMs: number | undefined;
33
+ protected readonly signer: OfflineSigner;
34
+ protected readonly aminoTypes: AminoTypes;
35
+ protected readonly gasPrice: GasPrice | undefined;
36
+ /**
37
+ * Creates an instance by connecting to the given Tendermint RPC endpoint.
38
+ *
39
+ * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
40
+ * support, see `createWithSigner`.
41
+ */
42
+ static connectWithSigner(endpoint: string | HttpEndpoint, signer: OfflineSigner, options?: SigningStargateClientOptions): Promise<SigningStargateClient>;
43
+ /**
44
+ * Creates an instance from a manually created Tendermint client.
45
+ * Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
46
+ */
47
+ static createWithSigner(tmClient: TendermintClient, signer: OfflineSigner, options?: SigningStargateClientOptions): Promise<SigningStargateClient>;
48
+ /**
49
+ * Creates a client in offline mode.
50
+ *
51
+ * This should only be used in niche cases where you know exactly what you're doing,
52
+ * e.g. when building an offline signing application.
53
+ *
54
+ * When you try to use online functionality with such a signer, an
55
+ * exception will be raised.
56
+ */
57
+ static offline(signer: OfflineSigner, options?: SigningStargateClientOptions): Promise<SigningStargateClient>;
58
+ protected constructor(tmClient: TendermintClient | undefined, signer: OfflineSigner, options: SigningStargateClientOptions);
59
+ simulate(signerAddress: string, messages: readonly EncodeObject[], memo: string | undefined): Promise<number>;
60
+ sendTokens(senderAddress: string, recipientAddress: string, amount: readonly Coin[], fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
61
+ delegateTokens(delegatorAddress: string, validatorAddress: string, amount: Coin, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
62
+ undelegateTokens(delegatorAddress: string, validatorAddress: string, amount: Coin, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
63
+ withdrawRewards(delegatorAddress: string, validatorAddress: string, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
64
+ sendIbcTokens(senderAddress: string, recipientAddress: string, transferAmount: Coin, sourcePort: string, sourceChannel: string, timeoutHeight: Height | undefined,
65
+ /** timeout in seconds */
66
+ timeoutTimestamp: number | undefined, fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
67
+ signAndBroadcast(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
68
+ /**
69
+ * Gets account number and sequence from the API, creates a sign doc,
70
+ * creates a single signature and assembles the signed transaction.
71
+ *
72
+ * The sign mode (SIGN_MODE_DIRECT or SIGN_MODE_LEGACY_AMINO_JSON) is determined by this client's signer.
73
+ *
74
+ * You can pass signer data (account number, sequence and chain ID) explicitly instead of querying them
75
+ * from the chain. This is needed when signing for a multisig account, but it also allows for offline signing
76
+ * (See the SigningStargateClient.offline constructor).
77
+ */
78
+ sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData): Promise<TxRaw>;
79
+ protected signAmino(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, { accountNumber, sequence, chainId }: SignerData): Promise<TxRaw>;
80
+ protected signDirect(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, { accountNumber, sequence, chainId }: SignerData): Promise<TxRaw>;
81
+ }
82
+ //# sourceMappingURL=SigningStargateClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SigningStargateClient.d.ts","sourceRoot":"","sources":["../../../../src/core/stargate/SigningStargateClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACP,MAAM,eAAe,CAAA;AAGtB,OAAO,EACL,YAAY,EAKZ,aAAa,EACb,QAAQ,EAET,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,YAAY,EAEZ,gBAAgB,EACjB,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ACjC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,UAAU,GAC/C,OAAO,CAAC,KAAK,CAAC;CAkDlB"}
@@ -0,0 +1,260 @@
1
+ import { encodeSecp256k1Pubkey, makeSignDoc as makeSignDocAmino, } from '@cosmjs/amino';
2
+ import { fromBase64 } from '@cosmjs/encoding';
3
+ import { Int53, Uint53 } from '@cosmjs/math';
4
+ import { encodePubkey, isOfflineDirectSigner, makeAuthInfoBytes, makeSignDoc, Registry, } from '@cosmjs/proto-signing';
5
+ import { Tendermint34Client, } from '@cosmjs/tendermint-rpc';
6
+ import { assert, assertDefined } from '@cosmjs/utils';
7
+ import { MsgWithdrawDelegatorReward } from 'cosmjs-types/cosmos/distribution/v1beta1/tx';
8
+ import { MsgDelegate, MsgUndelegate, } from 'cosmjs-types/cosmos/staking/v1beta1/tx';
9
+ import { SignMode } from 'cosmjs-types/cosmos/tx/signing/v1beta1/signing';
10
+ import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
11
+ import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx';
12
+ import Long from 'long';
13
+ import { AminoTypes } from '@cosmjs/stargate';
14
+ import { calculateFee } from '@cosmjs/stargate';
15
+ import { createAuthzAminoConverters, createBankAminoConverters, createDistributionAminoConverters, createFeegrantAminoConverters, createGovAminoConverters, createIbcAminoConverters, createStakingAminoConverters, createVestingAminoConverters, } from '@cosmjs/stargate';
16
+ import { defaultRegistryTypes, } from '@cosmjs/stargate';
17
+ import { StargateClient } from './StargateClient';
18
+ import { getPublicKey } from '../modules';
19
+ export function createDefaultAminoConverters() {
20
+ return {
21
+ ...createAuthzAminoConverters(),
22
+ ...createBankAminoConverters(),
23
+ ...createDistributionAminoConverters(),
24
+ ...createGovAminoConverters(),
25
+ ...createStakingAminoConverters(),
26
+ ...createIbcAminoConverters(),
27
+ ...createFeegrantAminoConverters(),
28
+ ...createVestingAminoConverters(),
29
+ };
30
+ }
31
+ export class SigningStargateClient extends StargateClient {
32
+ registry;
33
+ broadcastTimeoutMs;
34
+ broadcastPollIntervalMs;
35
+ signer;
36
+ aminoTypes;
37
+ gasPrice;
38
+ /**
39
+ * Creates an instance by connecting to the given Tendermint RPC endpoint.
40
+ *
41
+ * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
42
+ * support, see `createWithSigner`.
43
+ */
44
+ static async connectWithSigner(endpoint, signer, options = {}) {
45
+ const tmClient = await Tendermint34Client.connect(endpoint);
46
+ return SigningStargateClient.createWithSigner(tmClient, signer, options);
47
+ }
48
+ /**
49
+ * Creates an instance from a manually created Tendermint client.
50
+ * Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
51
+ */
52
+ static async createWithSigner(tmClient, signer, options = {}) {
53
+ return new SigningStargateClient(tmClient, signer, options);
54
+ }
55
+ /**
56
+ * Creates a client in offline mode.
57
+ *
58
+ * This should only be used in niche cases where you know exactly what you're doing,
59
+ * e.g. when building an offline signing application.
60
+ *
61
+ * When you try to use online functionality with such a signer, an
62
+ * exception will be raised.
63
+ */
64
+ static async offline(signer, options = {}) {
65
+ return new SigningStargateClient(undefined, signer, options);
66
+ }
67
+ constructor(tmClient, signer, options) {
68
+ super(tmClient, options);
69
+ const { registry = new Registry(defaultRegistryTypes), aminoTypes = new AminoTypes(createDefaultAminoConverters()), } = options;
70
+ this.registry = registry;
71
+ this.aminoTypes = aminoTypes;
72
+ this.signer = signer;
73
+ this.broadcastTimeoutMs = options.broadcastTimeoutMs;
74
+ this.broadcastPollIntervalMs = options.broadcastPollIntervalMs;
75
+ this.gasPrice = options.gasPrice;
76
+ }
77
+ async simulate(signerAddress, messages, memo) {
78
+ const anyMsgs = messages.map((m) => this.registry.encodeAsAny(m));
79
+ const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
80
+ if (!accountFromSigner) {
81
+ throw new Error('Failed to retrieve account from signer');
82
+ }
83
+ const pubkey = encodeSecp256k1Pubkey(accountFromSigner.pubkey);
84
+ const { sequence } = await this.getSequence(signerAddress);
85
+ const { gasInfo } = await this.forceGetQueryClient().tx.simulate(anyMsgs, memo, pubkey, sequence);
86
+ assertDefined(gasInfo);
87
+ return Uint53.fromString(gasInfo.gasUsed.toString()).toNumber();
88
+ }
89
+ async sendTokens(senderAddress, recipientAddress, amount, fee, memo = '') {
90
+ const sendMsg = {
91
+ typeUrl: '/cosmos.bank.v1beta1.MsgSend',
92
+ value: {
93
+ fromAddress: senderAddress,
94
+ toAddress: recipientAddress,
95
+ amount: [...amount],
96
+ },
97
+ };
98
+ return this.signAndBroadcast(senderAddress, [sendMsg], fee, memo);
99
+ }
100
+ async delegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = '') {
101
+ const delegateMsg = {
102
+ typeUrl: '/cosmos.staking.v1beta1.MsgDelegate',
103
+ value: MsgDelegate.fromPartial({
104
+ delegatorAddress: delegatorAddress,
105
+ validatorAddress: validatorAddress,
106
+ amount: amount,
107
+ }),
108
+ };
109
+ return this.signAndBroadcast(delegatorAddress, [delegateMsg], fee, memo);
110
+ }
111
+ async undelegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = '') {
112
+ const undelegateMsg = {
113
+ typeUrl: '/cosmos.staking.v1beta1.MsgUndelegate',
114
+ value: MsgUndelegate.fromPartial({
115
+ delegatorAddress: delegatorAddress,
116
+ validatorAddress: validatorAddress,
117
+ amount: amount,
118
+ }),
119
+ };
120
+ return this.signAndBroadcast(delegatorAddress, [undelegateMsg], fee, memo);
121
+ }
122
+ async withdrawRewards(delegatorAddress, validatorAddress, fee, memo = '') {
123
+ const withdrawMsg = {
124
+ typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
125
+ value: MsgWithdrawDelegatorReward.fromPartial({
126
+ delegatorAddress: delegatorAddress,
127
+ validatorAddress: validatorAddress,
128
+ }),
129
+ };
130
+ return this.signAndBroadcast(delegatorAddress, [withdrawMsg], fee, memo);
131
+ }
132
+ async sendIbcTokens(senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight,
133
+ /** timeout in seconds */
134
+ timeoutTimestamp, fee, memo = '') {
135
+ const timeoutTimestampNanoseconds = timeoutTimestamp
136
+ ? Long.fromNumber(timeoutTimestamp).multiply(1_000_000_000)
137
+ : undefined;
138
+ const transferMsg = {
139
+ typeUrl: '/ibc.applications.transfer.v1.MsgTransfer',
140
+ value: MsgTransfer.fromPartial({
141
+ sourcePort: sourcePort,
142
+ sourceChannel: sourceChannel,
143
+ sender: senderAddress,
144
+ receiver: recipientAddress,
145
+ token: transferAmount,
146
+ timeoutHeight: timeoutHeight,
147
+ timeoutTimestamp: timeoutTimestampNanoseconds,
148
+ }),
149
+ };
150
+ return this.signAndBroadcast(senderAddress, [transferMsg], fee, memo);
151
+ }
152
+ async signAndBroadcast(signerAddress, messages, fee, memo = '') {
153
+ let usedFee;
154
+ if (fee == 'auto' || typeof fee === 'number') {
155
+ assertDefined(this.gasPrice, 'Gas price must be set in the client options when auto gas is used.');
156
+ const gasEstimation = await this.simulate(signerAddress, messages, memo);
157
+ const multiplier = typeof fee === 'number' ? fee : 1.3;
158
+ usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice);
159
+ }
160
+ else {
161
+ usedFee = fee;
162
+ }
163
+ const txRaw = await this.sign(signerAddress, messages, usedFee, memo);
164
+ const txBytes = TxRaw.encode(txRaw).finish();
165
+ return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs);
166
+ }
167
+ /**
168
+ * Gets account number and sequence from the API, creates a sign doc,
169
+ * creates a single signature and assembles the signed transaction.
170
+ *
171
+ * The sign mode (SIGN_MODE_DIRECT or SIGN_MODE_LEGACY_AMINO_JSON) is determined by this client's signer.
172
+ *
173
+ * You can pass signer data (account number, sequence and chain ID) explicitly instead of querying them
174
+ * from the chain. This is needed when signing for a multisig account, but it also allows for offline signing
175
+ * (See the SigningStargateClient.offline constructor).
176
+ */
177
+ async sign(signerAddress, messages, fee, memo, explicitSignerData) {
178
+ let signerData;
179
+ if (explicitSignerData) {
180
+ signerData = explicitSignerData;
181
+ }
182
+ else {
183
+ const { accountNumber, sequence } = await this.getSequence(signerAddress);
184
+ const chainId = await this.getChainId();
185
+ signerData = {
186
+ accountNumber: accountNumber,
187
+ sequence: sequence,
188
+ chainId: chainId,
189
+ };
190
+ }
191
+ return isOfflineDirectSigner(this.signer)
192
+ ? this.signDirect(signerAddress, messages, fee, memo, signerData)
193
+ : this.signAmino(signerAddress, messages, fee, memo, signerData);
194
+ }
195
+ async signAmino(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
196
+ assert(!isOfflineDirectSigner(this.signer));
197
+ const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
198
+ if (!accountFromSigner) {
199
+ throw new Error('Failed to retrieve account from signer');
200
+ }
201
+ const pubkey = chainId.startsWith('injective')
202
+ ? getPublicKey({
203
+ chainId,
204
+ key: Buffer.from(accountFromSigner.pubkey).toString('base64'),
205
+ })
206
+ : encodePubkey(encodeSecp256k1Pubkey(accountFromSigner.pubkey));
207
+ const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
208
+ const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
209
+ const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence);
210
+ const { signature, signed } = await this.signer.signAmino(signerAddress, signDoc);
211
+ const signedTxBody = {
212
+ messages: signed.msgs.map((msg) => this.aminoTypes.fromAmino(msg)),
213
+ memo: signed.memo,
214
+ };
215
+ const signedTxBodyEncodeObject = {
216
+ typeUrl: '/cosmos.tx.v1beta1.TxBody',
217
+ value: signedTxBody,
218
+ };
219
+ const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
220
+ const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
221
+ const signedSequence = Int53.fromString(signed.sequence).toNumber();
222
+ const signedAuthInfoBytes = makeAuthInfoBytes([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signed.fee.granter, signed.fee.payer, signMode);
223
+ return TxRaw.fromPartial({
224
+ bodyBytes: signedTxBodyBytes,
225
+ authInfoBytes: signedAuthInfoBytes,
226
+ signatures: [fromBase64(signature.signature)],
227
+ });
228
+ }
229
+ async signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
230
+ assert(isOfflineDirectSigner(this.signer));
231
+ const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
232
+ if (!accountFromSigner) {
233
+ throw new Error('Failed to retrieve account from signer');
234
+ }
235
+ const pubkey = chainId.startsWith('injective')
236
+ ? getPublicKey({
237
+ chainId,
238
+ key: Buffer.from(accountFromSigner.pubkey).toString('base64'),
239
+ })
240
+ : encodePubkey(encodeSecp256k1Pubkey(accountFromSigner.pubkey));
241
+ const txBodyEncodeObject = {
242
+ typeUrl: '/cosmos.tx.v1beta1.TxBody',
243
+ value: {
244
+ messages: messages,
245
+ memo: memo,
246
+ },
247
+ };
248
+ const txBodyBytes = this.registry.encode(txBodyEncodeObject);
249
+ const gasLimit = Int53.fromString(fee.gas).toNumber();
250
+ const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit, fee.granter, fee.payer);
251
+ const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
252
+ const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc);
253
+ return TxRaw.fromPartial({
254
+ bodyBytes: signed.bodyBytes,
255
+ authInfoBytes: signed.authInfoBytes,
256
+ signatures: [fromBase64(signature.signature)],
257
+ });
258
+ }
259
+ }
260
+ //# sourceMappingURL=SigningStargateClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SigningStargateClient.js","sourceRoot":"","sources":["../../../../src/core/stargate/SigningStargateClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,WAAW,IAAI,gBAAgB,GAEhC,MAAM,eAAe,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AG,CAAC,OAAO,EACX,GAAG,CAAC,KAAK,CACV,CAAA;QACD,MAAM,OAAO,GAAG,WAAW,CACzB,WAAW,EACX,aAAa,EACb,OAAO,EACP,aAAa,CACd,CAAA;QACD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CACxD,aAAa,EACb,OAAO,CACR,CAAA;QACD,OAAO,KAAK,CAAC,WAAW,CAAC;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SAC9C,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -1,2 +1,3 @@
1
1
  export { StargateClient as InjectiveStargateClient } from './StargateClient';
2
+ export { SigningStargateClient as InjectiveSigningStargateClient } from './SigningStargateClient';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,qBAAqB,IAAI,8BAA8B,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export { StargateClient as InjectiveStargateClient } from './StargateClient';
2
+ export { SigningStargateClient as InjectiveSigningStargateClient } from './SigningStargateClient';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/stargate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,qBAAqB,IAAI,8BAA8B,EAAE,MAAM,yBAAyB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/sdk-ts",
3
3
  "description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
4
- "version": "1.10.73-beta.4",
4
+ "version": "1.10.73-beta.5",
5
5
  "sideEffects": false,
6
6
  "license": "Apache-2.0",
7
7
  "author": {
@@ -37,17 +37,17 @@
37
37
  "@cosmjs/stargate": "^0.30.1",
38
38
  "@ethersproject/bytes": "^5.7.0",
39
39
  "@injectivelabs/core-proto-ts": "^0.0.14",
40
- "@injectivelabs/exceptions": "^1.10.13-beta.1",
40
+ "@injectivelabs/exceptions": "^1.10.13-beta.2",
41
41
  "@injectivelabs/grpc-web": "^0.0.1",
42
42
  "@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
43
43
  "@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
44
44
  "@injectivelabs/indexer-proto-ts": "1.10.8-rc.4",
45
45
  "@injectivelabs/mito-proto-ts": "1.0.9",
46
- "@injectivelabs/networks": "^1.10.13-beta.1",
47
- "@injectivelabs/test-utils": "^1.10.13-beta.1",
48
- "@injectivelabs/token-metadata": "^1.11.0-beta.2",
49
- "@injectivelabs/ts-types": "^1.10.13-beta.1",
50
- "@injectivelabs/utils": "^1.10.13-beta.1",
46
+ "@injectivelabs/networks": "^1.10.13-beta.2",
47
+ "@injectivelabs/test-utils": "^1.10.13-beta.2",
48
+ "@injectivelabs/token-metadata": "^1.11.0-beta.3",
49
+ "@injectivelabs/ts-types": "^1.10.13-beta.2",
50
+ "@injectivelabs/utils": "^1.10.13-beta.2",
51
51
  "@metamask/eth-sig-util": "^4.0.0",
52
52
  "axios": "^0.27.2",
53
53
  "bech32": "^2.0.0",
@@ -68,7 +68,7 @@
68
68
  "shx": "^0.3.2",
69
69
  "snakecase-keys": "^5.4.1"
70
70
  },
71
- "gitHead": "5ca48c8bc1d889fc2bde25016d3f71f36a747f54",
71
+ "gitHead": "202b18cee8657b2d63d0396293727cd4ffeb08fd",
72
72
  "typedoc": {
73
73
  "entryPoint": "./src/index.ts",
74
74
  "readmeFile": "./README.md",