@dydxprotocol/v4-client-js 1.4.0 → 1.5.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/CHANGELOG.md +2 -2
- package/__native__/__ios__/v4-native-client.js +5755 -5762
- package/build/src/clients/composite-client.d.ts +1 -0
- package/build/src/clients/composite-client.js +6 -1
- package/build/src/clients/modules/post.d.ts +6 -0
- package/build/src/clients/modules/post.js +12 -1
- package/build/src/clients/validator-client.d.ts +4 -0
- package/build/src/clients/validator-client.js +9 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/clients/composite-client.ts +5 -0
- package/src/clients/modules/post.ts +12 -0
- package/src/clients/validator-client.ts +9 -0
package/package.json
CHANGED
|
@@ -109,6 +109,11 @@ export class CompositeClient {
|
|
|
109
109
|
this._validatorClient.setSelectedGasDenom(gasDenom);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
async populateAccountNumberCache(address: string): Promise<void> {
|
|
113
|
+
if (!this._validatorClient) throw new Error('Validator client not initialized');
|
|
114
|
+
await this._validatorClient.populateAccountNumberCache(address);
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
/**
|
|
113
118
|
* @description Sign a list of messages with a wallet.
|
|
114
119
|
* the calling function is responsible for creating the messages.
|
|
@@ -76,6 +76,18 @@ export class Post {
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @description Retrieves the account number for the given wallet address and populates the accountNumberCache.
|
|
81
|
+
* The account number is required for txOptions when signing a transaction.
|
|
82
|
+
* Pre-populating the cache avoids a round-trip request during the first transaction creation in the session, preventing it from being a performance blocker.
|
|
83
|
+
*/
|
|
84
|
+
public async populateAccountNumberCache(address: string): Promise<void> {
|
|
85
|
+
if (this.accountNumberCache.has(address)) return;
|
|
86
|
+
|
|
87
|
+
const account = await this.get.getAccount(address);
|
|
88
|
+
this.accountNumberCache.set(address, account);
|
|
89
|
+
}
|
|
90
|
+
|
|
79
91
|
setSelectedGasDenom(selectedGasDenom: SelectedGasDenom): void {
|
|
80
92
|
this.selectedGasDenom = selectedGasDenom;
|
|
81
93
|
}
|
|
@@ -69,6 +69,15 @@ export class ValidatorClient {
|
|
|
69
69
|
this._post.setSelectedGasDenom(gasDenom);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @description populate account number cache in the Post module for performance.
|
|
75
|
+
*/
|
|
76
|
+
async populateAccountNumberCache(address: string): Promise<void> {
|
|
77
|
+
if (!this._post) throw new Error('Post module not initialized');
|
|
78
|
+
await this._post.populateAccountNumberCache(address);
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
private async initialize(): Promise<void> {
|
|
73
82
|
const tendermint37Client: Tendermint37Client = await Tendermint37Client.connect(
|
|
74
83
|
this.config.restEndpoint,
|