@dydxprotocol/v4-client-js 1.2.1 → 1.3.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/__native__/__ios__/v4-native-client.js +5626 -5591
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/cosmos/bundle.d.ts +158 -158
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/cosmos/bundle.js +126 -126
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/accountplus/accountplus.d.ts +35 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/accountplus/accountplus.js +127 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/accountplus/genesis.d.ts +16 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/accountplus/genesis.js +65 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/bundle.d.ts +2762 -1461
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/bundle.js +290 -249
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/order.d.ts +2 -3
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/order.js +3 -4
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/order_removals.d.ts +5 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/order_removals.js +11 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/process_proposer_matches_events.d.ts +6 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/process_proposer_matches_events.js +1 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/query.d.ts +130 -6
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/query.js +252 -5
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/query.rpc.Query.d.ts +9 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/query.rpc.Query.js +10 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/events/events.d.ts +202 -4
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/events/events.js +329 -6
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/off_chain_updates/off_chain_updates.d.ts +28 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/off_chain_updates/off_chain_updates.js +92 -7
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/shared/removal_reason.d.ts +5 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/shared/removal_reason.js +11 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/socks/messages.d.ts +20 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/indexer/socks/messages.js +54 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/lcd.d.ts +2 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/lcd.js +7 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/genesis.d.ts +19 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/genesis.js +64 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/query.d.ts +27 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/query.js +90 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/query.rpc.Query.d.ts +16 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/query.rpc.Query.js +52 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/tx.d.ts +35 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/tx.js +98 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/tx.rpc.msg.d.ts +12 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/listing/tx.rpc.msg.js +41 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/pending_send_packet.d.ts +24 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/pending_send_packet.js +73 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/query.d.ts +37 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/query.js +65 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/query.lcd.d.ts +2 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/query.lcd.js +7 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/query.rpc.Query.d.ts +5 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/ratelimit/query.rpc.Query.js +10 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/genesis.d.ts +16 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/genesis.js +64 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/params.d.ts +29 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/params.js +80 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/query.d.ts +55 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/query.js +162 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/query.lcd.d.ts +10 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/query.lcd.js +23 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/query.rpc.Query.d.ts +23 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/query.rpc.Query.js +61 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/revshare.d.ts +23 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/revshare.js +64 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/tx.d.ts +69 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/tx.js +178 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/tx.rpc.msg.d.ts +21 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/revshare/tx.rpc.msg.js +47 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/rpc.query.d.ts +17 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/rpc.query.js +3 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/rpc.tx.d.ts +2 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/rpc.tx.js +3 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/perpetual_position.d.ts +3 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/perpetual_position.js +11 -3
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/query.d.ts +55 -4
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/query.js +87 -5
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/query.lcd.d.ts +3 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/query.lcd.js +9 -3
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/query.rpc.Query.d.ts +8 -4
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/subaccounts/query.rpc.Query.js +11 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/genesis.d.ts +37 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/genesis.js +104 -5
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/params.d.ts +96 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/params.js +196 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/query.d.ts +134 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/query.js +395 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/query.lcd.d.ts +12 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/query.lcd.js +49 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/query.rpc.Query.d.ts +19 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/query.rpc.Query.js +66 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/share.d.ts +31 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/share.js +108 -0
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/tx.d.ts +84 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/tx.js +151 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/tx.rpc.msg.d.ts +7 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/tx.rpc.msg.js +13 -1
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/vault.d.ts +0 -14
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/dydxprotocol/vault/vault.js +2 -38
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/gogoproto/bundle.js +2 -2
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/google/bundle.d.ts +174 -174
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/google/bundle.js +12 -12
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/helpers.d.ts +4 -4
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/tendermint/bundle.d.ts +365 -365
- package/build/node_modules/@dydxprotocol/v4-proto/src/codegen/tendermint/bundle.js +22 -22
- package/build/src/clients/composite-client.js +6 -6
- package/build/src/clients/lib/cctpProto.d.ts +4 -4
- package/build/src/clients/modules/get.d.ts +1 -1
- package/build/src/clients/modules/get.js +3 -3
- package/build/src/clients/native.d.ts +1 -1
- package/build/src/clients/native.js +3 -3
- package/build/src/clients/types.d.ts +7 -7
- package/build/src/clients/validator-client.js +4 -4
- package/build/src/index.d.ts +1 -0
- package/build/src/index.js +3 -2
- package/build/src/types.d.ts +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +3 -4
- package/src/clients/modules/get.ts +2 -2
- package/src/clients/native.ts +2 -2
- package/src/index.ts +1 -0
- package/tsconfig.json +0 -1
- package/webpack.config.js +1 -0
- package/.telescope.json +0 -15
- package/src/codegen/helpers.ts +0 -241
- package/src/codegen/index.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dydxprotocol/v4-client-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "General client library for the new dYdX system (v4 decentralized)",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"lint": "eslint --ext .ts,.js .",
|
|
13
13
|
"prepublishOnly": "npm run compile",
|
|
14
14
|
"start": "node build/src/index.js",
|
|
15
|
-
"transpile": "rm -rf src/codegen && telescope transpile --protoDirs ./proto --outPath ./src/codegen --no-includeAminos --includeLCDClients --includeRPCClients",
|
|
16
15
|
"test": "NODE_ENV=test jest --testPathIgnorePatterns=__tests__/modules/client/*",
|
|
17
16
|
"test:watch": "npm test -- --watch",
|
|
18
17
|
"test-integration": "NODE_ENV=test jest",
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"@cosmjs/stargate": "^0.32.1",
|
|
38
37
|
"@cosmjs/tendermint-rpc": "^0.32.1",
|
|
39
38
|
"@cosmjs/utils": "^0.32.1",
|
|
40
|
-
"@dydxprotocol/v4-proto": "
|
|
39
|
+
"@dydxprotocol/v4-proto": "6.0.1",
|
|
41
40
|
"@osmonauts/lcd": "^0.6.0",
|
|
42
41
|
"@scure/bip32": "^1.1.5",
|
|
43
42
|
"@scure/bip39": "^1.1.1",
|
|
@@ -53,7 +52,6 @@
|
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"@dydxprotocol/node-service-base-dev": "^0.2.6",
|
|
56
|
-
"@osmonauts/telescope": "0.80.0",
|
|
57
55
|
"@protobufs/cosmos": "^0.0.11",
|
|
58
56
|
"@protobufs/gogoproto": "^0.0.10",
|
|
59
57
|
"@types/ffi-napi": "^4.0.4",
|
|
@@ -77,6 +75,7 @@
|
|
|
77
75
|
"stream-http": "^3.2.0",
|
|
78
76
|
"ts-loader": "^9.4.2",
|
|
79
77
|
"ts-proto": "^1.165.1",
|
|
78
|
+
"util": "^0.12.5",
|
|
80
79
|
"webpack": "^5.77.0",
|
|
81
80
|
"webpack-cli": "^5.0.1"
|
|
82
81
|
}
|
|
@@ -491,9 +491,9 @@ export class Get {
|
|
|
491
491
|
return GovV1Module.QueryProposalsResponse.decode(data);
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
async getWithdrawalAndTransferGatingStatus(): Promise<SubaccountsModule.QueryGetWithdrawalAndTransfersBlockedInfoResponse> {
|
|
494
|
+
async getWithdrawalAndTransferGatingStatus(perpetualId: number): Promise<SubaccountsModule.QueryGetWithdrawalAndTransfersBlockedInfoResponse> {
|
|
495
495
|
const requestData = Uint8Array.from(
|
|
496
|
-
SubaccountsModule.QueryGetWithdrawalAndTransfersBlockedInfoRequest.encode({}).finish(),
|
|
496
|
+
SubaccountsModule.QueryGetWithdrawalAndTransfersBlockedInfoRequest.encode({ perpetualId }).finish(),
|
|
497
497
|
);
|
|
498
498
|
|
|
499
499
|
const data = await this.sendQuery(
|
package/src/clients/native.ts
CHANGED
|
@@ -1211,14 +1211,14 @@ export async function getWithdrawalCapacityByDenom(payload: string): Promise<str
|
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
-
export async function getWithdrawalAndTransferGatingStatus(): Promise<string> {
|
|
1214
|
+
export async function getWithdrawalAndTransferGatingStatus(perpetualId: number): Promise<string> {
|
|
1215
1215
|
try {
|
|
1216
1216
|
const client = globalThis.client;
|
|
1217
1217
|
if (client === undefined) {
|
|
1218
1218
|
throw new UserError('client is not connected. Call connectClient() first');
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
|
-
const response = await client.validatorClient.get.getWithdrawalAndTransferGatingStatus();
|
|
1221
|
+
const response = await client.validatorClient.get.getWithdrawalAndTransferGatingStatus(perpetualId);
|
|
1222
1222
|
return encodeJson(response);
|
|
1223
1223
|
} catch (error) {
|
|
1224
1224
|
return wrappedError(error);
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
package/webpack.config.js
CHANGED
package/.telescope.json
DELETED
package/src/codegen/helpers.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file and any referenced files were automatically generated by @osmonauts/telescope@0.80.0
|
|
3
|
-
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
4
|
-
* and run the transpile command or yarn proto command to regenerate this bundle.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as _m0 from 'protobufjs/minimal';
|
|
8
|
-
import Long from 'long';
|
|
9
|
-
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
if (_m0.util.Long !== Long) {
|
|
12
|
-
_m0.util.Long = Long as any;
|
|
13
|
-
|
|
14
|
-
_m0.configure();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { Long };
|
|
18
|
-
|
|
19
|
-
declare var self: any | undefined;
|
|
20
|
-
declare var window: any | undefined;
|
|
21
|
-
declare var global: any | undefined;
|
|
22
|
-
var globalThis: any = (() => {
|
|
23
|
-
if (typeof globalThis !== 'undefined') return globalThis;
|
|
24
|
-
if (typeof self !== 'undefined') return self;
|
|
25
|
-
if (typeof window !== 'undefined') return window;
|
|
26
|
-
if (typeof global !== 'undefined') return global;
|
|
27
|
-
throw 'Unable to locate global object';
|
|
28
|
-
})();
|
|
29
|
-
|
|
30
|
-
const atob: (b64: string) => string =
|
|
31
|
-
globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
|
|
32
|
-
|
|
33
|
-
export function bytesFromBase64(b64: string): Uint8Array {
|
|
34
|
-
const bin = atob(b64);
|
|
35
|
-
const arr = new Uint8Array(bin.length);
|
|
36
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
37
|
-
arr[i] = bin.charCodeAt(i);
|
|
38
|
-
}
|
|
39
|
-
return arr;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const btoa: (bin: string) => string =
|
|
43
|
-
globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
|
|
44
|
-
|
|
45
|
-
export function base64FromBytes(arr: Uint8Array): string {
|
|
46
|
-
const bin: string[] = [];
|
|
47
|
-
arr.forEach((byte) => {
|
|
48
|
-
bin.push(String.fromCharCode(byte));
|
|
49
|
-
});
|
|
50
|
-
return btoa(bin.join(''));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface AminoHeight {
|
|
54
|
-
readonly revision_number?: string;
|
|
55
|
-
readonly revision_height?: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function omitDefault<T extends string | number | Long>(input: T): T | undefined {
|
|
59
|
-
if (typeof input === 'string') {
|
|
60
|
-
return input === '' ? undefined : input;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (typeof input === 'number') {
|
|
64
|
-
return input === 0 ? undefined : input;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (Long.isLong(input)) {
|
|
68
|
-
return input.isZero() ? undefined : input;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
throw new Error(`Got unsupported type ${typeof input}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface Duration {
|
|
75
|
-
/**
|
|
76
|
-
* Signed seconds of the span of time. Must be from -315,576,000,000
|
|
77
|
-
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
78
|
-
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
79
|
-
*/
|
|
80
|
-
seconds: Long;
|
|
81
|
-
/**
|
|
82
|
-
* Signed fractions of a second at nanosecond resolution of the span
|
|
83
|
-
* of time. Durations less than one second are represented with a 0
|
|
84
|
-
* `seconds` field and a positive or negative `nanos` field. For durations
|
|
85
|
-
* of one second or more, a non-zero value for the `nanos` field must be
|
|
86
|
-
* of the same sign as the `seconds` field. Must be from -999,999,999
|
|
87
|
-
* to +999,999,999 inclusive.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
nanos: number;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function toDuration(duration: string): Duration {
|
|
94
|
-
return {
|
|
95
|
-
seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),
|
|
96
|
-
nanos: parseInt(duration) % 1000000000,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function fromDuration(duration: Duration): string {
|
|
101
|
-
return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function isSet(value: any): boolean {
|
|
105
|
-
return value !== null && value !== undefined;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function isObject(value: any): boolean {
|
|
109
|
-
return typeof value === 'object' && value !== null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface PageRequest {
|
|
113
|
-
key: Uint8Array;
|
|
114
|
-
offset: Long;
|
|
115
|
-
limit: Long;
|
|
116
|
-
countTotal: boolean;
|
|
117
|
-
reverse: boolean;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface PageRequestParams {
|
|
121
|
-
'pagination.key'?: string;
|
|
122
|
-
'pagination.offset'?: string;
|
|
123
|
-
'pagination.limit'?: string;
|
|
124
|
-
'pagination.count_total'?: boolean;
|
|
125
|
-
'pagination.reverse'?: boolean;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface Params {
|
|
129
|
-
params: PageRequestParams;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export const setPaginationParams = (options: Params, pagination?: PageRequest) => {
|
|
133
|
-
if (!pagination) {
|
|
134
|
-
return options;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (typeof pagination?.countTotal !== 'undefined') {
|
|
138
|
-
options.params['pagination.count_total'] = pagination.countTotal;
|
|
139
|
-
}
|
|
140
|
-
if (typeof pagination?.key !== 'undefined') {
|
|
141
|
-
// String to Uint8Array
|
|
142
|
-
// let uint8arr = new Uint8Array(Buffer.from(data,'base64'));
|
|
143
|
-
|
|
144
|
-
// Uint8Array to String
|
|
145
|
-
options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');
|
|
146
|
-
}
|
|
147
|
-
if (typeof pagination?.limit !== 'undefined') {
|
|
148
|
-
options.params['pagination.limit'] = pagination.limit.toString();
|
|
149
|
-
}
|
|
150
|
-
if (typeof pagination?.offset !== 'undefined') {
|
|
151
|
-
options.params['pagination.offset'] = pagination.offset.toString();
|
|
152
|
-
}
|
|
153
|
-
if (typeof pagination?.reverse !== 'undefined') {
|
|
154
|
-
options.params['pagination.reverse'] = pagination.reverse;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return options;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
161
|
-
|
|
162
|
-
export type DeepPartial<T> = T extends Builtin
|
|
163
|
-
? T
|
|
164
|
-
: T extends Long
|
|
165
|
-
? string | number | Long
|
|
166
|
-
: T extends Array<infer U>
|
|
167
|
-
? Array<DeepPartial<U>>
|
|
168
|
-
: T extends ReadonlyArray<infer U>
|
|
169
|
-
? ReadonlyArray<DeepPartial<U>>
|
|
170
|
-
: T extends {}
|
|
171
|
-
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
172
|
-
: Partial<T>;
|
|
173
|
-
|
|
174
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
175
|
-
export type Exact<P, I extends P> = P extends Builtin
|
|
176
|
-
? P
|
|
177
|
-
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
178
|
-
|
|
179
|
-
export interface Rpc {
|
|
180
|
-
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
interface Timestamp {
|
|
184
|
-
/**
|
|
185
|
-
* Represents seconds of UTC time since Unix epoch
|
|
186
|
-
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
187
|
-
* 9999-12-31T23:59:59Z inclusive.
|
|
188
|
-
*/
|
|
189
|
-
seconds: Long;
|
|
190
|
-
/**
|
|
191
|
-
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
192
|
-
* second values with fractions must still have non-negative nanos values
|
|
193
|
-
* that count forward in time. Must be from 0 to 999,999,999
|
|
194
|
-
* inclusive.
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
nanos: number;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export function toTimestamp(date: Date): Timestamp {
|
|
201
|
-
const seconds = numberToLong(date.getTime() / 1_000);
|
|
202
|
-
const nanos = (date.getTime() % 1000) * 1000000;
|
|
203
|
-
return {
|
|
204
|
-
seconds,
|
|
205
|
-
nanos,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function fromTimestamp(t: Timestamp): Date {
|
|
210
|
-
let millis = t.seconds.toNumber() * 1000;
|
|
211
|
-
millis += t.nanos / 1000000;
|
|
212
|
-
return new Date(millis);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const fromJSON = (object: any): Timestamp => {
|
|
216
|
-
return {
|
|
217
|
-
seconds: isSet(object.seconds) ? Long.fromString(object.seconds) : Long.ZERO,
|
|
218
|
-
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const timestampFromJSON = (object: any): Timestamp => {
|
|
223
|
-
return {
|
|
224
|
-
seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,
|
|
225
|
-
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
export function fromJsonTimestamp(o: any): Timestamp {
|
|
230
|
-
if (o instanceof Date) {
|
|
231
|
-
return toTimestamp(o);
|
|
232
|
-
} else if (typeof o === 'string') {
|
|
233
|
-
return toTimestamp(new Date(o));
|
|
234
|
-
} else {
|
|
235
|
-
return timestampFromJSON(o);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function numberToLong(number: number) {
|
|
240
|
-
return Long.fromNumber(number);
|
|
241
|
-
}
|
package/src/codegen/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file and any referenced files were automatically generated by @osmonauts/telescope@0.80.0
|
|
3
|
-
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
4
|
-
* and run the transpile command or yarn proto command to regenerate this bundle.
|
|
5
|
-
*/
|