@bulletxyz/bullet-sdk 0.49.0 → 0.49.2
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/browser/bullet_wasm_bg.wasm +0 -0
- package/dist/browser/index.js +29 -17
- package/dist/browser/index.js.map +5 -5
- package/dist/node/bullet_wasm_bg.wasm +0 -0
- package/dist/node/index.js +29 -17
- package/dist/node/index.js.map +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/client.d.ts +4 -3
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/rollupTypes.d.ts +14 -0
- package/dist/types/rollupTypes.d.ts.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/zod-types/rest.d.ts +16 -2
- package/dist/types/zod-types/rest.d.ts.map +1 -1
- package/package.json +1 -1
|
Binary file
|
package/dist/node/index.js
CHANGED
|
@@ -1584,11 +1584,6 @@ function serialize(value) {
|
|
|
1584
1584
|
return value;
|
|
1585
1585
|
if (Decimal.isDecimal(value))
|
|
1586
1586
|
return value.toFixed();
|
|
1587
|
-
if (typeof value === "bigint") {
|
|
1588
|
-
if (value > BigInt(Number.MAX_SAFE_INTEGER))
|
|
1589
|
-
throw new Error(`BigInt value ${value} is too large for safe conversion`);
|
|
1590
|
-
return Number(value);
|
|
1591
|
-
}
|
|
1592
1587
|
if (value instanceof Set)
|
|
1593
1588
|
return Array.from(value).map(serialize);
|
|
1594
1589
|
if (value instanceof Map)
|
|
@@ -2317,6 +2312,11 @@ var StateResponseSchemas = {
|
|
|
2317
2312
|
UserAccountConfigV0: z3.object({
|
|
2318
2313
|
delegates: createJsonMap(Base58Address, z3.string())
|
|
2319
2314
|
}),
|
|
2315
|
+
DelegateContainer: z3.object({
|
|
2316
|
+
delegator: Base58Address,
|
|
2317
|
+
expires_at: UnixTimestampMicros.nullable(),
|
|
2318
|
+
flags: U32Schema
|
|
2319
|
+
}),
|
|
2320
2320
|
RiskEngineV0: z3.object({
|
|
2321
2321
|
pricing_engine: PricingEngine,
|
|
2322
2322
|
margin_config: MarginConfig
|
|
@@ -2374,12 +2374,16 @@ var StateResponseSchemas = {
|
|
|
2374
2374
|
found: createJsonMap(MarketId, Schemas.OrderbookL2),
|
|
2375
2375
|
not_found: z3.array(MarketId)
|
|
2376
2376
|
})),
|
|
2377
|
-
|
|
2377
|
+
UserAccount: createBaseResponse(z3.object({
|
|
2378
2378
|
address: Base58Address,
|
|
2379
2379
|
account: Schemas.UserAccount
|
|
2380
2380
|
})),
|
|
2381
|
+
Delegate: createBaseResponse(z3.object({
|
|
2382
|
+
address: Base58Address,
|
|
2383
|
+
container: Schemas.DelegateContainer
|
|
2384
|
+
})),
|
|
2381
2385
|
UserAccountConfig: StateResponseSchemas.StateMapElement(Base58Address, VersionedV0(Schemas.UserAccountConfigV0)),
|
|
2382
|
-
|
|
2386
|
+
UserAccountBulk: createBaseResponse(z3.object({
|
|
2383
2387
|
found: createJsonMap(Base58Address, Schemas.UserAccount),
|
|
2384
2388
|
not_found: z3.array(Base58Address)
|
|
2385
2389
|
})),
|
|
@@ -2545,7 +2549,7 @@ class ReadOnlyClient {
|
|
|
2545
2549
|
if (!this.assetInfoRegistry)
|
|
2546
2550
|
throw new Error("Asset registry not initialized. Call initializeRegistries() first.");
|
|
2547
2551
|
let assetInfo = this.assetInfoRegistry.get(assetName);
|
|
2548
|
-
if (!assetInfo
|
|
2552
|
+
if (!assetInfo?.tokenId)
|
|
2549
2553
|
throw new Error(`Token address not found for asset ${assetName}`);
|
|
2550
2554
|
return assetInfo.tokenId;
|
|
2551
2555
|
}
|
|
@@ -2602,18 +2606,22 @@ class ReadOnlyClient {
|
|
|
2602
2606
|
}
|
|
2603
2607
|
async getUserAccount(address) {
|
|
2604
2608
|
let path = `/modules/exchange/api/v1/account/${address}`, response = await this.fetchApiResource(path);
|
|
2605
|
-
return ResponseSchemas.
|
|
2609
|
+
return ResponseSchemas.UserAccount.parse(response).account;
|
|
2606
2610
|
}
|
|
2607
2611
|
async getUserAccounts(addresses) {
|
|
2608
2612
|
let response = await this.fetchBulkApiResource("/modules/exchange/api/v1/account/bulk", {
|
|
2609
2613
|
addresses
|
|
2610
2614
|
});
|
|
2611
|
-
return ResponseSchemas.
|
|
2615
|
+
return ResponseSchemas.UserAccountBulk.parse(response).found;
|
|
2612
2616
|
}
|
|
2613
2617
|
async getUserAccountConfig(address) {
|
|
2614
2618
|
let path = `/modules/exchange/state/user-account-configs/items/${address}`, response = await this.fetchApiResource(path);
|
|
2615
2619
|
return ResponseSchemas.UserAccountConfig.parse(response).value;
|
|
2616
2620
|
}
|
|
2621
|
+
async getDelegateContainer(delegate) {
|
|
2622
|
+
let path = `/modules/exchange/api/v1/delegate/${delegate}`, response = await this.fetchApiResource(path);
|
|
2623
|
+
return ResponseSchemas.Delegate.parse(response).container;
|
|
2624
|
+
}
|
|
2617
2625
|
async getExchangeAssets() {
|
|
2618
2626
|
let response = await this.fetchApiResource("/modules/exchange/state/exchange-assets");
|
|
2619
2627
|
return ResponseSchemas.ExchangeAssets.parse(response).value;
|
|
@@ -3771,14 +3779,16 @@ class AuthenticatedClient extends ReadOnlyClient {
|
|
|
3771
3779
|
}
|
|
3772
3780
|
});
|
|
3773
3781
|
}
|
|
3774
|
-
async delegateUser(delegate, name, subAccountIndex) {
|
|
3782
|
+
async delegateUser(delegate, name, flags, subAccountIndex = null, expiresAt = null) {
|
|
3775
3783
|
return await this.submitTransaction({
|
|
3776
3784
|
exchange: {
|
|
3777
3785
|
user: {
|
|
3778
|
-
|
|
3786
|
+
delegate_user_v_2: {
|
|
3779
3787
|
delegate,
|
|
3780
3788
|
name,
|
|
3781
|
-
sub_account_index: subAccountIndex
|
|
3789
|
+
sub_account_index: subAccountIndex,
|
|
3790
|
+
expires_at: expiresAt,
|
|
3791
|
+
flags
|
|
3782
3792
|
}
|
|
3783
3793
|
}
|
|
3784
3794
|
}
|
|
@@ -3796,14 +3806,16 @@ class AuthenticatedClient extends ReadOnlyClient {
|
|
|
3796
3806
|
}
|
|
3797
3807
|
});
|
|
3798
3808
|
}
|
|
3799
|
-
async vaultDelegateUser(vaultAddress, delegate, name) {
|
|
3809
|
+
async vaultDelegateUser(vaultAddress, delegate, name, flags, expiresAt = null) {
|
|
3800
3810
|
return await this.submitTransaction({
|
|
3801
3811
|
exchange: {
|
|
3802
3812
|
vault: {
|
|
3803
|
-
|
|
3813
|
+
delegate_vault_user_v_1: {
|
|
3804
3814
|
vault_address: vaultAddress,
|
|
3805
3815
|
delegate,
|
|
3806
|
-
name
|
|
3816
|
+
name,
|
|
3817
|
+
expires_at: expiresAt,
|
|
3818
|
+
flags
|
|
3807
3819
|
}
|
|
3808
3820
|
}
|
|
3809
3821
|
}
|
|
@@ -4421,4 +4433,4 @@ export {
|
|
|
4421
4433
|
AbortError
|
|
4422
4434
|
};
|
|
4423
4435
|
|
|
4424
|
-
//# debugId=
|
|
4436
|
+
//# debugId=3292D5FB9802B47E64756E2164756E21
|