ault-sdk-ts 0.17.0 → 0.18.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/README.md +14 -0
- package/dist/core/errors.d.ts +17 -0
- package/dist/core/network.d.ts +11 -11
- package/dist/core/vault-msgs.d.ts +10 -0
- package/dist/high-level/types.d.ts +3 -1
- package/dist/index.cjs +338 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +338 -129
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/clob/v1/group.d.ts +2 -2
- package/dist/proto/gen/ault/lending/v1/genesis.d.ts +1 -0
- package/dist/proto/gen/ault/lending/v1/lending.d.ts +5 -5
- package/dist/proto/gen/ault/lending/v1/query.d.ts +10 -0
- package/dist/proto/gen/ault/margin/v1/margin.d.ts +4 -4
- package/dist/proto/gen/ault/oracle/v1/genesis.d.ts +18 -2
- package/dist/proto/gen/ault/oracle/v1/oracle.d.ts +7 -13
- package/dist/proto/gen/ault/oracle/v1/query.d.ts +53 -0
- package/dist/proto/gen/ault/oracle/v1/tx.d.ts +2 -5
- package/dist/proto/gen/ault/perpetual/v1/perpetual.d.ts +16 -4
- package/dist/proto/gen/ault/perpetual/v1/tx.d.ts +41 -0
- package/dist/proto/gen/ault/vault/v1/params.d.ts +4 -1
- package/dist/proto/gen/ault/vault/v1/query.d.ts +2 -1
- package/dist/proto/gen/ault/vault/v1/tx.d.ts +2 -1
- package/dist/proto/gen/ault/vault/v1/vault.d.ts +13 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -561,6 +561,7 @@ fee, and starts with your initial deposit:
|
|
|
561
561
|
|
|
562
562
|
```typescript
|
|
563
563
|
await client.createVault({
|
|
564
|
+
description: { name: "USDC lending", details: "Supplies pool 1" },
|
|
564
565
|
vaultDenom: usdc.denom,
|
|
565
566
|
managementFeeBps: 200,
|
|
566
567
|
config: {
|
|
@@ -573,6 +574,7 @@ await client.createVault({
|
|
|
573
574
|
});
|
|
574
575
|
|
|
575
576
|
await client.createVault({
|
|
577
|
+
description: { name: "Spot and perps" },
|
|
576
578
|
config: { trading: { allowedActions: ["spot", "perpetual"], spotMarketIds: [marketId] } },
|
|
577
579
|
// Without a fund window the exit fee must be positive; with one it is zero.
|
|
578
580
|
exitFeeBps: 50,
|
|
@@ -581,6 +583,10 @@ await client.createVault({
|
|
|
581
583
|
});
|
|
582
584
|
```
|
|
583
585
|
|
|
586
|
+
Since v3.0.0-rc.5 every vault needs a `description`. Its `name` is required
|
|
587
|
+
(up to 70 bytes of UTF-8) and `details` is optional (up to 280). The chain
|
|
588
|
+
keeps both as they were at creation.
|
|
589
|
+
|
|
584
590
|
`fundWindow` (`depositOpenTime`, `depositCloseTime`, `redemptionOpenTime`)
|
|
585
591
|
limits when deposits and redemptions happen; a vault without one takes both
|
|
586
592
|
at any time. `vaultAddressKind(address)` reads a vault's type and relationship
|
|
@@ -1390,6 +1396,14 @@ transaction, so look it up by `error.txHash` before you sign and send it again.
|
|
|
1390
1396
|
A `TxNotConfirmedError` means the broadcast was accepted but the transaction
|
|
1391
1397
|
did not show up in a block before the timeout.
|
|
1392
1398
|
|
|
1399
|
+
A wallet send can fail before anything is broadcast with `SignerMismatchError`.
|
|
1400
|
+
The SDK checks that the signature the wallet returned was made by the signer's
|
|
1401
|
+
own key. It was not if the wallet signed with another account, hashes EIP-712
|
|
1402
|
+
typed data in a non-standard way, or is a contract wallet that does not produce
|
|
1403
|
+
ECDSA signatures. `error.signerAddress` is the account you asked to sign with
|
|
1404
|
+
and `error.recoveredAddress` is the one the signature belongs to. Nothing was
|
|
1405
|
+
sent, so there is no transaction to look up.
|
|
1406
|
+
|
|
1393
1407
|
## Advanced Usage
|
|
1394
1408
|
|
|
1395
1409
|
For advanced use cases, you can access the low-level client:
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -69,6 +69,23 @@ export declare class TxNotConfirmedError extends TxError {
|
|
|
69
69
|
export declare class TxConfirmationUnavailableError extends TxError {
|
|
70
70
|
constructor(params: TxErrorParams);
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Thrown before anything is broadcast when the wallet's signature was not made
|
|
74
|
+
* by the signer's key: it signed with another account, hashed the EIP-712
|
|
75
|
+
* payload its own way, or is not an ECDSA wallet at all (a contract wallet).
|
|
76
|
+
* `recoveredAddress` is the address the signature does recover to, when one
|
|
77
|
+
* could be recovered. Nothing was sent, so the sequence is untouched.
|
|
78
|
+
*/
|
|
79
|
+
export declare class SignerMismatchError extends Error {
|
|
80
|
+
/** The signer's address, in 0x form. */
|
|
81
|
+
signerAddress: string;
|
|
82
|
+
recoveredAddress?: string;
|
|
83
|
+
constructor(params: {
|
|
84
|
+
signerAddress: string;
|
|
85
|
+
recoveredAddress?: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
72
89
|
/**
|
|
73
90
|
* Thrown in wait mode when the tx committed successfully (DeliverTx code 0) but
|
|
74
91
|
* the expected per-message response was missing from `tx_response.data` — e.g. a
|
package/dist/core/network.d.ts
CHANGED
|
@@ -61,10 +61,10 @@ export declare const GAS_CONSTANTS: {
|
|
|
61
61
|
readonly CANCEL_ORDER_BASE: 52000;
|
|
62
62
|
readonly CANCEL_ORDER_PER_ID: 29000;
|
|
63
63
|
readonly MODIFY_ORDER_PER_ID: 155000;
|
|
64
|
-
readonly CONDITIONAL_ORDER:
|
|
64
|
+
readonly CONDITIONAL_ORDER: 140000;
|
|
65
65
|
readonly MODIFY_CONDITIONAL_BASE: 55000;
|
|
66
66
|
readonly MODIFY_CONDITIONAL_PER_ORDER: 49000;
|
|
67
|
-
readonly GROUP_ORDER:
|
|
67
|
+
readonly GROUP_ORDER: 254000;
|
|
68
68
|
readonly OPEN_ACCOUNT: 96000;
|
|
69
69
|
readonly PERP_DEPOSIT: 250000;
|
|
70
70
|
readonly PERP_WITHDRAW: 250000;
|
|
@@ -74,21 +74,21 @@ export declare const GAS_CONSTANTS: {
|
|
|
74
74
|
readonly PERP_LIQUIDATE_PER_ACCOUNT: 1000000;
|
|
75
75
|
readonly LENDING_SUPPLY: 122000;
|
|
76
76
|
readonly LENDING_WITHDRAW: 115000;
|
|
77
|
-
readonly LENDING_SUPPLY_COLLATERAL:
|
|
78
|
-
readonly LENDING_WITHDRAW_COLLATERAL:
|
|
79
|
-
readonly LENDING_BORROW:
|
|
77
|
+
readonly LENDING_SUPPLY_COLLATERAL: 115000;
|
|
78
|
+
readonly LENDING_WITHDRAW_COLLATERAL: 260000;
|
|
79
|
+
readonly LENDING_BORROW: 280000;
|
|
80
80
|
readonly LENDING_REPAY: 100000;
|
|
81
|
-
readonly LENDING_LIQUIDATE:
|
|
81
|
+
readonly LENDING_LIQUIDATE: 490000;
|
|
82
82
|
readonly LENDING_FUND_INSURANCE_FUND: 150000;
|
|
83
83
|
readonly MARGIN_DEPOSIT_BASE: 88000;
|
|
84
|
-
readonly MARGIN_DEPOSIT_PER_COIN:
|
|
84
|
+
readonly MARGIN_DEPOSIT_PER_COIN: 53000;
|
|
85
85
|
readonly MARGIN_WITHDRAW_BASE: 74000;
|
|
86
|
-
readonly MARGIN_WITHDRAW_PER_COIN:
|
|
87
|
-
readonly MARGIN_BORROW:
|
|
86
|
+
readonly MARGIN_WITHDRAW_PER_COIN: 210000;
|
|
87
|
+
readonly MARGIN_BORROW: 250000;
|
|
88
88
|
readonly MARGIN_REPAY: 259000;
|
|
89
|
-
readonly VAULT_CREATE_TRADING_BASE:
|
|
89
|
+
readonly VAULT_CREATE_TRADING_BASE: 220000;
|
|
90
90
|
readonly VAULT_CREATE_PER_MARKET: 9000;
|
|
91
|
-
readonly VAULT_CREATE_LENDING_BASE:
|
|
91
|
+
readonly VAULT_CREATE_LENDING_BASE: 160000;
|
|
92
92
|
readonly VAULT_CREATE_PER_LENDING_POOL: 7000;
|
|
93
93
|
readonly VAULT_UPDATE_MANAGER: 95000;
|
|
94
94
|
readonly VAULT_UPDATE_CONFIG_TRADING_BASE: 85000;
|
|
@@ -35,6 +35,14 @@ export interface TradingVaultConfigInput {
|
|
|
35
35
|
/** Close the redeemed share of open positions on every redemption. */
|
|
36
36
|
alwaysCloseOnRedemption?: boolean;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A vault's display name and details, set at creation and never changed after.
|
|
40
|
+
* `name` is required and takes up to 70 bytes of UTF-8; `details` up to 280.
|
|
41
|
+
*/
|
|
42
|
+
export interface VaultDescriptionInput {
|
|
43
|
+
name: string;
|
|
44
|
+
details?: string;
|
|
45
|
+
}
|
|
38
46
|
export type VaultConfigInput = {
|
|
39
47
|
lending: LendingVaultConfigInput;
|
|
40
48
|
} | {
|
|
@@ -89,6 +97,8 @@ export declare function buildVaultRedeemMsg(sender: string, params: {
|
|
|
89
97
|
* `initialDeposit`; trading vaults use the perpetual collateral denom.
|
|
90
98
|
*/
|
|
91
99
|
export declare function buildCreateVaultMsg(owner: string, params: {
|
|
100
|
+
/** Display name and details; immutable once the vault exists. */
|
|
101
|
+
description: VaultDescriptionInput;
|
|
92
102
|
config: VaultConfigInput;
|
|
93
103
|
/** Lending vaults only: the denom depositors supply. */
|
|
94
104
|
vaultDenom?: string;
|
|
@@ -16,7 +16,7 @@ import type { PerpetualApi } from "../rest/perpetual";
|
|
|
16
16
|
import type { LendingApi } from "../rest/lending";
|
|
17
17
|
import type { MarginOrderOptions } from "../core/margin-msgs";
|
|
18
18
|
import type { LendingPoolId } from "../core/lending-msgs";
|
|
19
|
-
import type { VaultConfigInput, VaultFundWindowInput, VaultStatusInput } from "../core/vault-msgs";
|
|
19
|
+
import type { VaultConfigInput, VaultDescriptionInput, VaultFundWindowInput, VaultStatusInput } from "../core/vault-msgs";
|
|
20
20
|
import type { MarginApi } from "../rest/margin";
|
|
21
21
|
import type { OracleApi } from "../rest/oracle";
|
|
22
22
|
import type { VaultApi } from "../rest/vault";
|
|
@@ -624,6 +624,8 @@ export interface VaultTxApi {
|
|
|
624
624
|
} & TxOptions): Promise<TxResult>;
|
|
625
625
|
}
|
|
626
626
|
export interface CreateVaultParams {
|
|
627
|
+
/** Display name (required) and details; neither can be changed after creation. */
|
|
628
|
+
description: VaultDescriptionInput;
|
|
627
629
|
config: VaultConfigInput;
|
|
628
630
|
/** Lending vaults only: the denom depositors supply. Trading vaults use the perpetual collateral denom. */
|
|
629
631
|
vaultDenom?: string;
|