ault-sdk-ts 0.0.2-alpha.18 → 0.0.2-alpha.19

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.
@@ -27,6 +27,10 @@ export declare const ManifestGasSchema: z.ZodObject<{
27
27
  CANCEL_ORDER_BASE: z.ZodOptional<z.ZodNumber>;
28
28
  CANCEL_ORDER_PER_ID: z.ZodOptional<z.ZodNumber>;
29
29
  OPEN_ACCOUNT: z.ZodOptional<z.ZodNumber>;
30
+ DELEGATE: z.ZodOptional<z.ZodNumber>;
31
+ UNDELEGATE: z.ZodOptional<z.ZodNumber>;
32
+ BEGIN_REDELEGATE: z.ZodOptional<z.ZodNumber>;
33
+ WITHDRAW_DELEGATOR_REWARD: z.ZodOptional<z.ZodNumber>;
30
34
  }, z.core.$strip>;
31
35
  export declare const ManifestEip712Schema: z.ZodObject<{
32
36
  feeDenom: z.ZodOptional<z.ZodString>;
@@ -74,6 +78,10 @@ export declare const ManifestSchema: z.ZodObject<{
74
78
  CANCEL_ORDER_BASE: z.ZodOptional<z.ZodNumber>;
75
79
  CANCEL_ORDER_PER_ID: z.ZodOptional<z.ZodNumber>;
76
80
  OPEN_ACCOUNT: z.ZodOptional<z.ZodNumber>;
81
+ DELEGATE: z.ZodOptional<z.ZodNumber>;
82
+ UNDELEGATE: z.ZodOptional<z.ZodNumber>;
83
+ BEGIN_REDELEGATE: z.ZodOptional<z.ZodNumber>;
84
+ WITHDRAW_DELEGATOR_REWARD: z.ZodOptional<z.ZodNumber>;
77
85
  }, z.core.$strip>>;
78
86
  eip712: z.ZodOptional<z.ZodObject<{
79
87
  feeDenom: z.ZodOptional<z.ZodString>;
@@ -57,6 +57,10 @@ export declare const GAS_CONSTANTS: {
57
57
  readonly CANCEL_ORDER_BASE: 49000;
58
58
  readonly CANCEL_ORDER_PER_ID: 22000;
59
59
  readonly OPEN_ACCOUNT: 96000;
60
+ readonly DELEGATE: 220000;
61
+ readonly UNDELEGATE: 220000;
62
+ readonly BEGIN_REDELEGATE: 280000;
63
+ readonly WITHDRAW_DELEGATOR_REWARD: 220000;
60
64
  };
61
65
  /**
62
66
  * Returns the per-tx gas allowance for a uniform-cost batch (in wire-format
@@ -1,3 +1,3 @@
1
1
  import type { StakingTxApi } from "../types";
2
2
  import type { TxModuleContext } from "./context";
3
- export declare function createStakingTxApi({ signerAddress, exec }: TxModuleContext): StakingTxApi;
3
+ export declare function createStakingTxApi({ signerAddress, exec, getGas }: TxModuleContext): StakingTxApi;
package/dist/index.cjs CHANGED
@@ -703,7 +703,12 @@ var GAS_CONSTANTS = {
703
703
  CANCEL_ORDER_BASE: 49e3,
704
704
  CANCEL_ORDER_PER_ID: 22e3,
705
705
  // Accountx module
706
- OPEN_ACCOUNT: 96e3
706
+ OPEN_ACCOUNT: 96e3,
707
+ // Staking module (cosmos-sdk standard, NOT fee-free — user pays gas).
708
+ DELEGATE: 22e4,
709
+ UNDELEGATE: 22e4,
710
+ BEGIN_REDELEGATE: 28e4,
711
+ WITHDRAW_DELEGATOR_REWARD: 22e4
707
712
  };
708
713
  function computeFeeFreeGas(minGasPerOp, count, multiplier = GAS_CONSTANTS.FEE_FREE_GAS_MULTIPLIER) {
709
714
  return (BigInt(minGasPerOp) * BigInt(count) * BigInt(multiplier) / 100n).toString();
@@ -22790,9 +22795,10 @@ function createRewardTxApi({ signerAddress, exec, getGas }) {
22790
22795
  }
22791
22796
 
22792
22797
  // src/high-level/tx/staking.ts
22793
- function createStakingTxApi({ signerAddress, exec }) {
22798
+ function createStakingTxApi({ signerAddress, exec, getGas }) {
22794
22799
  return {
22795
22800
  async delegate({ validatorAddress, amount, gasLimit, feeAmount, memo, confirmationTimeoutMs }) {
22801
+ const gas = getGas();
22796
22802
  return exec(
22797
22803
  [
22798
22804
  msg.staking.delegate({
@@ -22801,7 +22807,12 @@ function createStakingTxApi({ signerAddress, exec }) {
22801
22807
  amount
22802
22808
  })
22803
22809
  ],
22804
- { gasLimit, feeAmount, memo, confirmationTimeoutMs }
22810
+ {
22811
+ gasLimit: gasLimit ?? computeFeeFreeGas(gas.DELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
22812
+ feeAmount,
22813
+ memo,
22814
+ confirmationTimeoutMs
22815
+ }
22805
22816
  );
22806
22817
  },
22807
22818
  async undelegate({
@@ -22812,6 +22823,7 @@ function createStakingTxApi({ signerAddress, exec }) {
22812
22823
  memo,
22813
22824
  confirmationTimeoutMs
22814
22825
  }) {
22826
+ const gas = getGas();
22815
22827
  return exec(
22816
22828
  [
22817
22829
  msg.staking.undelegate({
@@ -22820,7 +22832,12 @@ function createStakingTxApi({ signerAddress, exec }) {
22820
22832
  amount
22821
22833
  })
22822
22834
  ],
22823
- { gasLimit, feeAmount, memo, confirmationTimeoutMs }
22835
+ {
22836
+ gasLimit: gasLimit ?? computeFeeFreeGas(gas.UNDELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
22837
+ feeAmount,
22838
+ memo,
22839
+ confirmationTimeoutMs
22840
+ }
22824
22841
  );
22825
22842
  },
22826
22843
  async redelegate({
@@ -22832,6 +22849,7 @@ function createStakingTxApi({ signerAddress, exec }) {
22832
22849
  memo,
22833
22850
  confirmationTimeoutMs
22834
22851
  }) {
22852
+ const gas = getGas();
22835
22853
  return exec(
22836
22854
  [
22837
22855
  msg.staking.beginRedelegate({
@@ -22841,7 +22859,12 @@ function createStakingTxApi({ signerAddress, exec }) {
22841
22859
  amount
22842
22860
  })
22843
22861
  ],
22844
- { gasLimit, feeAmount, memo, confirmationTimeoutMs }
22862
+ {
22863
+ gasLimit: gasLimit ?? computeFeeFreeGas(gas.BEGIN_REDELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
22864
+ feeAmount,
22865
+ memo,
22866
+ confirmationTimeoutMs
22867
+ }
22845
22868
  );
22846
22869
  },
22847
22870
  async withdrawRewards({
@@ -22855,6 +22878,8 @@ function createStakingTxApi({ signerAddress, exec }) {
22855
22878
  throw new Error("validatorAddresses must include at least one validator address.");
22856
22879
  }
22857
22880
  const normalized = validatorAddresses.map(assertValidatorAddress);
22881
+ const gas = getGas();
22882
+ const resolvedGasLimit = gasLimit ?? computeFeeFreeGas(gas.WITHDRAW_DELEGATOR_REWARD, 1, gas.FEE_FREE_GAS_MULTIPLIER);
22858
22883
  const results = [];
22859
22884
  const partial = [];
22860
22885
  for (let i = 0; i < normalized.length; i++) {
@@ -22867,7 +22892,7 @@ function createStakingTxApi({ signerAddress, exec }) {
22867
22892
  validatorAddress
22868
22893
  })
22869
22894
  ],
22870
- { gasLimit, feeAmount, memo, confirmationTimeoutMs }
22895
+ { gasLimit: resolvedGasLimit, feeAmount, memo, confirmationTimeoutMs }
22871
22896
  );
22872
22897
  results.push(result);
22873
22898
  partial.push({ txHash: result.txHash, validatorAddress });
@@ -23025,7 +23050,11 @@ var ManifestGasSchema = import_zod.z.object({
23025
23050
  SCALE_ORDER_PER_SUB: import_zod.z.number().int().positive(),
23026
23051
  CANCEL_ORDER_BASE: import_zod.z.number().int().positive(),
23027
23052
  CANCEL_ORDER_PER_ID: import_zod.z.number().int().positive(),
23028
- OPEN_ACCOUNT: import_zod.z.number().int().positive()
23053
+ OPEN_ACCOUNT: import_zod.z.number().int().positive(),
23054
+ DELEGATE: import_zod.z.number().int().positive(),
23055
+ UNDELEGATE: import_zod.z.number().int().positive(),
23056
+ BEGIN_REDELEGATE: import_zod.z.number().int().positive(),
23057
+ WITHDRAW_DELEGATOR_REWARD: import_zod.z.number().int().positive()
23029
23058
  }).partial();
23030
23059
  var positiveIntegerString = import_zod.z.string().regex(/^[1-9]\d*$/, "must be a positive integer string (chain-side BigInt, > 0)");
23031
23060
  var nonNegativeIntegerString = import_zod.z.string().regex(/^\d+$/, "must be a non-negative integer string (chain-side BigInt)");
@@ -24363,7 +24392,7 @@ function createDexWs(url, options) {
24363
24392
  }
24364
24393
 
24365
24394
  // src/index.ts
24366
- var SDK_VERSION = "0.0.2-alpha.18";
24395
+ var SDK_VERSION = "0.0.2-alpha.19";
24367
24396
  // Annotate the CommonJS export names for ESM import in node:
24368
24397
  0 && (module.exports = {
24369
24398
  AGENT_DEFAULTS,