ault-sdk-ts 0.3.0 → 0.4.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/dist/core/clob-gas.d.ts +5 -19
- package/dist/core/manifest-resolver.d.ts +2 -3
- package/dist/core/network.d.ts +0 -9
- package/dist/index.cjs +16 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/clob-gas.d.ts
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { type GAS_CONSTANTS } from "./network";
|
|
2
2
|
/**
|
|
3
3
|
* Per-op fee-free gas formulas for the CLOB order methods, shared by the
|
|
4
|
-
* high-level (wallet) and agent factories.
|
|
5
|
-
*
|
|
6
|
-
* (see {@link cancelOrdersGas}). Each takes an explicit `gas` snapshot so a
|
|
7
|
-
* manifest hot-swap is honored on the next call.
|
|
4
|
+
* high-level (wallet) and agent factories. Each takes an explicit `gas`
|
|
5
|
+
* snapshot so a manifest hot-swap is honored on the next call.
|
|
8
6
|
*/
|
|
9
7
|
type Gas = typeof GAS_CONSTANTS;
|
|
10
8
|
export declare function limitOrderGas(gas: Gas): string;
|
|
11
9
|
export declare function marketOrderGas(gas: Gas): string;
|
|
12
10
|
export declare function scaleOrderGas(gas: Gas, subOrderCount: number): string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* fee-free multiplier doesn't absorb the ante the way limit/market/scale do.
|
|
17
|
-
* Wallet (EIP-712) cancels pass `true`; agent cancels are gas-capped and pass
|
|
18
|
-
* `false`. If chain `MinGasLimits` change, revisit whether the other ops also
|
|
19
|
-
* need the ante.
|
|
20
|
-
*/
|
|
21
|
-
export declare function cancelOrdersGas(gas: Gas, orderCount: number, includeAnte: boolean): string;
|
|
22
|
-
/**
|
|
23
|
-
* Modify gas: per-order minimum with no base (chain `MinGasPerModifyOrder`).
|
|
24
|
-
* Same ante reasoning as {@link cancelOrdersGas} — wallet modifies pass
|
|
25
|
-
* `includeAnte: true`; agent modifies are gas-capped and pass `false`.
|
|
26
|
-
*/
|
|
27
|
-
export declare function modifyOrdersGas(gas: Gas, orderCount: number, includeAnte: boolean): string;
|
|
11
|
+
export declare function cancelOrdersGas(gas: Gas, orderCount: number): string;
|
|
12
|
+
/** Modify gas: per-order minimum with no base (chain `MinGasPerModifyOrder`). */
|
|
13
|
+
export declare function modifyOrdersGas(gas: Gas, orderCount: number): string;
|
|
28
14
|
export {};
|
|
@@ -35,13 +35,12 @@ export declare function applyNetworkOverrides(network: NetworkConfig, manifest:
|
|
|
35
35
|
* `ManifestEip712Schema` (`feeAmount`, `gasLimit`, `feeDenom`) and apply
|
|
36
36
|
* through `applyNetworkOverrides` — the broadcast layer reads them off
|
|
37
37
|
* `network.eip712*`, so accepting them in the gas blob would be a silent
|
|
38
|
-
* no-op surface.
|
|
39
|
-
* manifest path at all.
|
|
38
|
+
* no-op surface.
|
|
40
39
|
*
|
|
41
40
|
* Single source of truth: `applyGasOverrides` strips these keys, and the
|
|
42
41
|
* schema/baseline parity test derives its exclusion set from this list.
|
|
43
42
|
*/
|
|
44
|
-
export declare const NON_OVERRIDABLE_GAS_KEYS: readonly ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "
|
|
43
|
+
export declare const NON_OVERRIDABLE_GAS_KEYS: readonly ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "DENOM"];
|
|
45
44
|
/**
|
|
46
45
|
* Returns a GAS_CONSTANTS-shaped object with manifest gas overrides applied.
|
|
47
46
|
*
|
package/dist/core/network.d.ts
CHANGED
|
@@ -39,15 +39,6 @@ export declare const GAS_CONSTANTS: {
|
|
|
39
39
|
readonly DENOM: "aault";
|
|
40
40
|
/** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
|
|
41
41
|
readonly FEE_FREE_GAS_MULTIPLIER: 120;
|
|
42
|
-
/**
|
|
43
|
-
* EIP-712 ante overhead, in gas. The chain's per-message MinGasLimit values
|
|
44
|
-
* (mirrored below) measure the *handler* cost only; a fee-free EIP-712 tx
|
|
45
|
-
* additionally burns ante gas (sig verification + typed-data decode + tx
|
|
46
|
-
* size) that counts against gasWanted. For small-base ops (cancel) the 1.2×
|
|
47
|
-
* buffer doesn't cover it, so the high-level (EIP-712) path adds this on top.
|
|
48
|
-
* The agent path is capped at MinGasLimit×1.2 and must not add it.
|
|
49
|
-
*/
|
|
50
|
-
readonly EIP712_ANTE_GAS: 30000;
|
|
51
42
|
readonly PER_LICENSE: 200000;
|
|
52
43
|
readonly PER_KYC_MEMBER: 200000;
|
|
53
44
|
readonly PER_DELEGATE_MINING: 200000;
|
package/dist/index.cjs
CHANGED
|
@@ -643,9 +643,7 @@ var NETWORKS = {
|
|
|
643
643
|
rpcUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/cosmos-rpc",
|
|
644
644
|
restUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/rest",
|
|
645
645
|
evmRpcUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/evm",
|
|
646
|
-
explorerUrl: "https://ault.explorer.
|
|
647
|
-
// The dex API lives on its own host, not behind the chain proxy above.
|
|
648
|
-
dexApiUrl: "https://am-api.cloud.aultblockchain.xyz",
|
|
646
|
+
explorerUrl: "https://ault.explorer.orynt.tech",
|
|
649
647
|
isProduction: true
|
|
650
648
|
},
|
|
651
649
|
"ault_10904-1": {
|
|
@@ -656,7 +654,7 @@ var NETWORKS = {
|
|
|
656
654
|
rpcUrl: "https://test-rpc.cloud.aultblockchain.xyz",
|
|
657
655
|
restUrl: "https://test-api.cloud.aultblockchain.xyz",
|
|
658
656
|
evmRpcUrl: "https://test-json-rpc.cloud.aultblockchain.xyz",
|
|
659
|
-
explorerUrl: "https://testnet
|
|
657
|
+
explorerUrl: "https://ault-testnet.explorer.orynt.tech",
|
|
660
658
|
dexApiUrl: "https://test-dex-api.cloud.aultblockchain.xyz",
|
|
661
659
|
isProduction: false
|
|
662
660
|
},
|
|
@@ -725,15 +723,6 @@ var GAS_CONSTANTS = {
|
|
|
725
723
|
DENOM: "aault",
|
|
726
724
|
/** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
|
|
727
725
|
FEE_FREE_GAS_MULTIPLIER: 120,
|
|
728
|
-
/**
|
|
729
|
-
* EIP-712 ante overhead, in gas. The chain's per-message MinGasLimit values
|
|
730
|
-
* (mirrored below) measure the *handler* cost only; a fee-free EIP-712 tx
|
|
731
|
-
* additionally burns ante gas (sig verification + typed-data decode + tx
|
|
732
|
-
* size) that counts against gasWanted. For small-base ops (cancel) the 1.2×
|
|
733
|
-
* buffer doesn't cover it, so the high-level (EIP-712) path adds this on top.
|
|
734
|
-
* The agent path is capped at MinGasLimit×1.2 and must not add it.
|
|
735
|
-
*/
|
|
736
|
-
EIP712_ANTE_GAS: 3e4,
|
|
737
726
|
// License module
|
|
738
727
|
PER_LICENSE: 2e5,
|
|
739
728
|
PER_KYC_MEMBER: 2e5,
|
|
@@ -23744,24 +23733,16 @@ function scaleOrderGas(gas, subOrderCount) {
|
|
|
23744
23733
|
gas.FEE_FREE_GAS_MULTIPLIER
|
|
23745
23734
|
);
|
|
23746
23735
|
}
|
|
23747
|
-
function cancelOrdersGas(gas, orderCount
|
|
23748
|
-
|
|
23736
|
+
function cancelOrdersGas(gas, orderCount) {
|
|
23737
|
+
return computeFeeFreeGasCompound(
|
|
23749
23738
|
gas.CANCEL_ORDER_BASE,
|
|
23750
23739
|
gas.CANCEL_ORDER_PER_ID,
|
|
23751
23740
|
orderCount,
|
|
23752
23741
|
gas.FEE_FREE_GAS_MULTIPLIER
|
|
23753
23742
|
);
|
|
23754
|
-
if (!includeAnte) return feeFree;
|
|
23755
|
-
return (BigInt(feeFree) + BigInt(gas.EIP712_ANTE_GAS)).toString();
|
|
23756
23743
|
}
|
|
23757
|
-
function modifyOrdersGas(gas, orderCount
|
|
23758
|
-
|
|
23759
|
-
gas.MODIFY_ORDER_PER_ID,
|
|
23760
|
-
orderCount,
|
|
23761
|
-
gas.FEE_FREE_GAS_MULTIPLIER
|
|
23762
|
-
);
|
|
23763
|
-
if (!includeAnte) return feeFree;
|
|
23764
|
-
return (BigInt(feeFree) + BigInt(gas.EIP712_ANTE_GAS)).toString();
|
|
23744
|
+
function modifyOrdersGas(gas, orderCount) {
|
|
23745
|
+
return computeFeeFreeGas(gas.MODIFY_ORDER_PER_ID, orderCount, gas.FEE_FREE_GAS_MULTIPLIER);
|
|
23765
23746
|
}
|
|
23766
23747
|
|
|
23767
23748
|
// src/high-level/tx/clob.ts
|
|
@@ -23813,16 +23794,18 @@ function createClobTxApi({ signerAddress, exec, getGas }) {
|
|
|
23813
23794
|
orderIds,
|
|
23814
23795
|
wait,
|
|
23815
23796
|
gasLimit,
|
|
23797
|
+
feeDenom,
|
|
23816
23798
|
feeAmount,
|
|
23817
23799
|
memo,
|
|
23818
23800
|
confirmationTimeoutMs
|
|
23819
23801
|
}) {
|
|
23820
23802
|
const gas = getGas();
|
|
23821
|
-
const cancelGas = gasLimit ?? cancelOrdersGas(gas, orderIds.length
|
|
23803
|
+
const cancelGas = gasLimit ?? cancelOrdersGas(gas, orderIds.length);
|
|
23822
23804
|
return withWaitDecode(
|
|
23823
23805
|
wait,
|
|
23824
23806
|
(w) => exec([buildCancelOrdersMsg(signerAddress, orderIds)], {
|
|
23825
23807
|
gasLimit: cancelGas,
|
|
23808
|
+
feeDenom,
|
|
23826
23809
|
feeAmount,
|
|
23827
23810
|
memo,
|
|
23828
23811
|
confirmationTimeoutMs,
|
|
@@ -23835,6 +23818,7 @@ function createClobTxApi({ signerAddress, exec, getGas }) {
|
|
|
23835
23818
|
orders,
|
|
23836
23819
|
wait,
|
|
23837
23820
|
gasLimit,
|
|
23821
|
+
feeDenom,
|
|
23838
23822
|
feeAmount,
|
|
23839
23823
|
memo,
|
|
23840
23824
|
confirmationTimeoutMs
|
|
@@ -23842,11 +23826,12 @@ function createClobTxApi({ signerAddress, exec, getGas }) {
|
|
|
23842
23826
|
const modifyMsg = buildModifyOrdersMsg(signerAddress, orders);
|
|
23843
23827
|
assertUniformModifyShape(orders);
|
|
23844
23828
|
const gas = getGas();
|
|
23845
|
-
const modifyGas = gasLimit ?? modifyOrdersGas(gas, orders.length
|
|
23829
|
+
const modifyGas = gasLimit ?? modifyOrdersGas(gas, orders.length);
|
|
23846
23830
|
return withWaitDecode(
|
|
23847
23831
|
wait,
|
|
23848
23832
|
(w) => exec([modifyMsg], {
|
|
23849
23833
|
gasLimit: modifyGas,
|
|
23834
|
+
feeDenom,
|
|
23850
23835
|
feeAmount,
|
|
23851
23836
|
memo,
|
|
23852
23837
|
confirmationTimeoutMs,
|
|
@@ -25019,12 +25004,7 @@ function applyNetworkOverrides(network, manifest) {
|
|
|
25019
25004
|
...manifest.eip712?.gasLimit != null ? { eip712GasLimit: manifest.eip712.gasLimit } : {}
|
|
25020
25005
|
};
|
|
25021
25006
|
}
|
|
25022
|
-
var NON_OVERRIDABLE_GAS_KEYS = [
|
|
25023
|
-
"EIP712_FEE_AMOUNT",
|
|
25024
|
-
"EIP712_GAS_LIMIT",
|
|
25025
|
-
"EIP712_ANTE_GAS",
|
|
25026
|
-
"DENOM"
|
|
25027
|
-
];
|
|
25007
|
+
var NON_OVERRIDABLE_GAS_KEYS = ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "DENOM"];
|
|
25028
25008
|
var NON_OVERRIDABLE_GAS_KEY_SET = new Set(NON_OVERRIDABLE_GAS_KEYS);
|
|
25029
25009
|
function applyGasOverrides(gas) {
|
|
25030
25010
|
if (!gas) return GAS_CONSTANTS;
|
|
@@ -25404,8 +25384,7 @@ function createAgentClobTxApi({
|
|
|
25404
25384
|
return withWaitDecode(
|
|
25405
25385
|
wait,
|
|
25406
25386
|
(w) => exec([buildCancelOrdersMsg(masterAddress, orderIds)], {
|
|
25407
|
-
|
|
25408
|
-
gasLimit: gasLimit ?? cancelOrdersGas(gas, orderIds.length, false),
|
|
25387
|
+
gasLimit: gasLimit ?? cancelOrdersGas(gas, orderIds.length),
|
|
25409
25388
|
memo,
|
|
25410
25389
|
confirmationTimeoutMs,
|
|
25411
25390
|
timeoutSeconds,
|
|
@@ -25426,8 +25405,7 @@ function createAgentClobTxApi({
|
|
|
25426
25405
|
return withWaitDecode(
|
|
25427
25406
|
wait,
|
|
25428
25407
|
(w) => exec([buildModifyOrdersMsg(masterAddress, orders)], {
|
|
25429
|
-
|
|
25430
|
-
gasLimit: gasLimit ?? modifyOrdersGas(gas, orders.length, false),
|
|
25408
|
+
gasLimit: gasLimit ?? modifyOrdersGas(gas, orders.length),
|
|
25431
25409
|
memo,
|
|
25432
25410
|
confirmationTimeoutMs,
|
|
25433
25411
|
timeoutSeconds,
|
|
@@ -26453,7 +26431,7 @@ function createDexWs(url, options) {
|
|
|
26453
26431
|
}
|
|
26454
26432
|
|
|
26455
26433
|
// src/index.ts
|
|
26456
|
-
var SDK_VERSION = "0.
|
|
26434
|
+
var SDK_VERSION = "0.4.0";
|
|
26457
26435
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26458
26436
|
0 && (module.exports = {
|
|
26459
26437
|
AGENT_DEFAULTS,
|