@dzapio/sdk 2.0.0 → 2.0.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.
@@ -3,9 +3,8 @@ import { WalletClient } from 'viem';
3
3
  import { DZapTransactionResponse, GaslessTradeBuildTxnResponse, HexString, TradeBuildTxnRequest, TradeBuildTxnResponse } from '../types';
4
4
  declare class TradeTxnHandler {
5
5
  private static sendTransaction;
6
- private static signTransaction;
7
6
  private static sendTxnWithBatch;
8
- private static broadcastTransaction;
7
+ private static sendHyperLiquidTransaction;
9
8
  static buildAndSendTransaction: ({ request, signer, txnData, multicallAddress, batchTransaction, rpcUrls, }: {
10
9
  request: TradeBuildTxnRequest;
11
10
  signer: Signer | WalletClient;
@@ -125,6 +125,12 @@ export type TradeQuotesRequest = {
125
125
  account?: string;
126
126
  allowedProtocols?: string[];
127
127
  filter?: QuoteFilter;
128
+ timingStrategy?: Partial<{
129
+ minWaitTimeMs: number;
130
+ maxWaitTimeMs: number;
131
+ subsequentDelayMs: number;
132
+ preferredResultCount: number;
133
+ }>;
128
134
  };
129
135
  export type TradeQuotesRequestData = {
130
136
  amount: string;
@@ -467,9 +473,10 @@ export type SignPermitResponse = {
467
473
  code: StatusCodes;
468
474
  permitType: PermitMode;
469
475
  };
476
+ export type BroadcastTxData = string;
470
477
  export type BroadcastTxParams = {
471
478
  txId: string;
472
479
  chainId: number;
473
- signedTxData: HexString;
480
+ txData: BroadcastTxData;
474
481
  };
475
482
  export {};
@@ -1,9 +1,9 @@
1
- import { Signer } from 'ethers';
1
+ import { Signer, TypedDataField } from 'ethers';
2
2
  import { HexString, PermitMode, StatusCodes, TxnStatus } from '..';
3
3
  import { GaslessTxType } from '../constants';
4
4
  import { permit2PrimaryType } from '../constants/permit';
5
5
  import { ContractVersion } from '../enums';
6
- import { Address, WalletClient } from 'viem';
6
+ import { Address, TypedDataDomain, WalletClient } from 'viem';
7
7
  import { AvailableDZapServices, TokenPermitData } from '.';
8
8
  export declare const defaultWitnessType: {
9
9
  typeName: string;
@@ -111,6 +111,14 @@ export type DefaultPermit2612Params = {
111
111
  type GaslessSwapPermit2612Params = BasePermitParams & GaslessSwapParams;
112
112
  type GaslessBridgePermit2612Params = BasePermitParams & GaslessBridgeParams;
113
113
  export type Gasless2612PermitParams = GaslessSwapPermit2612Params | GaslessBridgePermit2612Params;
114
+ export type CustomTypedDataParams = {
115
+ account: HexString;
116
+ signer: WalletClient | Signer;
117
+ domain: TypedDataDomain;
118
+ types: Record<string, Array<TypedDataField>>;
119
+ message: Record<string, any>;
120
+ primaryType: string;
121
+ };
114
122
  export type Permit2612Params = DefaultPermit2612Params | Gasless2612PermitParams;
115
123
  export type BasePermit2Params = {
116
124
  tokens: TokenWithPermitData[];
@@ -56,15 +56,15 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
56
56
  getBlock: <includeTransactions extends boolean = false, blockTag extends import("viem").BlockTag = "latest">(args?: import("viem").GetBlockParameters<includeTransactions, blockTag> | undefined) => Promise<{
57
57
  number: blockTag extends "pending" ? null : bigint;
58
58
  nonce: blockTag extends "pending" ? null : `0x${string}`;
59
- gasLimit: bigint;
60
59
  hash: blockTag extends "pending" ? null : `0x${string}`;
61
- logsBloom: blockTag extends "pending" ? null : `0x${string}`;
62
60
  baseFeePerGas: bigint | null;
63
61
  blobGasUsed: bigint;
64
62
  difficulty: bigint;
65
63
  excessBlobGas: bigint;
66
64
  extraData: import("viem").Hex;
65
+ gasLimit: bigint;
67
66
  gasUsed: bigint;
67
+ logsBloom: blockTag extends "pending" ? null : `0x${string}`;
68
68
  miner: import("viem").Address;
69
69
  mixHash: import("viem").Hash;
70
70
  parentBeaconBlockRoot?: `0x${string}` | undefined;
@@ -90,14 +90,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
90
90
  s: import("viem").Hex;
91
91
  nonce: number;
92
92
  type: "legacy";
93
- yParity?: undefined | undefined;
94
93
  gas: bigint;
95
- maxFeePerBlobGas?: undefined | undefined;
94
+ yParity?: undefined | undefined;
95
+ blobVersionedHashes?: undefined | undefined;
96
96
  gasPrice: bigint;
97
+ maxFeePerBlobGas?: undefined | undefined;
97
98
  maxFeePerGas?: undefined | undefined;
98
99
  maxPriorityFeePerGas?: undefined | undefined;
99
100
  accessList?: undefined | undefined;
100
- blobVersionedHashes?: undefined | undefined;
101
101
  authorizationList?: undefined | undefined;
102
102
  hash: import("viem").Hash;
103
103
  input: import("viem").Hex;
@@ -115,14 +115,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
115
115
  s: import("viem").Hex;
116
116
  nonce: number;
117
117
  type: "eip2930";
118
- yParity: number;
119
118
  gas: bigint;
120
- maxFeePerBlobGas?: undefined | undefined;
119
+ yParity: number;
120
+ blobVersionedHashes?: undefined | undefined;
121
121
  gasPrice: bigint;
122
+ maxFeePerBlobGas?: undefined | undefined;
122
123
  maxFeePerGas?: undefined | undefined;
123
124
  maxPriorityFeePerGas?: undefined | undefined;
124
125
  accessList: import("viem").AccessList;
125
- blobVersionedHashes?: undefined | undefined;
126
126
  authorizationList?: undefined | undefined;
127
127
  hash: import("viem").Hash;
128
128
  input: import("viem").Hex;
@@ -140,14 +140,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
140
140
  s: import("viem").Hex;
141
141
  nonce: number;
142
142
  type: "eip1559";
143
- yParity: number;
144
143
  gas: bigint;
145
- maxFeePerBlobGas?: undefined | undefined;
144
+ yParity: number;
145
+ blobVersionedHashes?: undefined | undefined;
146
146
  gasPrice?: undefined | undefined;
147
+ maxFeePerBlobGas?: undefined | undefined;
147
148
  maxFeePerGas: bigint;
148
149
  maxPriorityFeePerGas: bigint;
149
150
  accessList: import("viem").AccessList;
150
- blobVersionedHashes?: undefined | undefined;
151
151
  authorizationList?: undefined | undefined;
152
152
  hash: import("viem").Hash;
153
153
  input: import("viem").Hex;
@@ -165,14 +165,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
165
165
  s: import("viem").Hex;
166
166
  nonce: number;
167
167
  type: "eip4844";
168
- yParity: number;
169
168
  gas: bigint;
170
- maxFeePerBlobGas: bigint;
169
+ yParity: number;
170
+ blobVersionedHashes: readonly import("viem").Hex[];
171
171
  gasPrice?: undefined | undefined;
172
+ maxFeePerBlobGas: bigint;
172
173
  maxFeePerGas: bigint;
173
174
  maxPriorityFeePerGas: bigint;
174
175
  accessList: import("viem").AccessList;
175
- blobVersionedHashes: readonly import("viem").Hex[];
176
176
  authorizationList?: undefined | undefined;
177
177
  hash: import("viem").Hash;
178
178
  input: import("viem").Hex;
@@ -190,14 +190,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
190
190
  s: import("viem").Hex;
191
191
  nonce: number;
192
192
  type: "eip7702";
193
- yParity: number;
194
193
  gas: bigint;
195
- maxFeePerBlobGas?: undefined | undefined;
194
+ yParity: number;
195
+ blobVersionedHashes?: undefined | undefined;
196
196
  gasPrice?: undefined | undefined;
197
+ maxFeePerBlobGas?: undefined | undefined;
197
198
  maxFeePerGas: bigint;
198
199
  maxPriorityFeePerGas: bigint;
199
200
  accessList: import("viem").AccessList;
200
- blobVersionedHashes?: undefined | undefined;
201
201
  authorizationList: import("viem").SignedAuthorizationList;
202
202
  hash: import("viem").Hash;
203
203
  input: import("viem").Hex;
@@ -240,14 +240,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
240
240
  s: import("viem").Hex;
241
241
  nonce: number;
242
242
  type: "legacy";
243
- yParity?: undefined | undefined;
244
243
  gas: bigint;
245
- maxFeePerBlobGas?: undefined | undefined;
244
+ yParity?: undefined | undefined;
245
+ blobVersionedHashes?: undefined | undefined;
246
246
  gasPrice: bigint;
247
+ maxFeePerBlobGas?: undefined | undefined;
247
248
  maxFeePerGas?: undefined | undefined;
248
249
  maxPriorityFeePerGas?: undefined | undefined;
249
250
  accessList?: undefined | undefined;
250
- blobVersionedHashes?: undefined | undefined;
251
251
  authorizationList?: undefined | undefined;
252
252
  hash: import("viem").Hash;
253
253
  input: import("viem").Hex;
@@ -265,14 +265,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
265
265
  s: import("viem").Hex;
266
266
  nonce: number;
267
267
  type: "eip2930";
268
- yParity: number;
269
268
  gas: bigint;
270
- maxFeePerBlobGas?: undefined | undefined;
269
+ yParity: number;
270
+ blobVersionedHashes?: undefined | undefined;
271
271
  gasPrice: bigint;
272
+ maxFeePerBlobGas?: undefined | undefined;
272
273
  maxFeePerGas?: undefined | undefined;
273
274
  maxPriorityFeePerGas?: undefined | undefined;
274
275
  accessList: import("viem").AccessList;
275
- blobVersionedHashes?: undefined | undefined;
276
276
  authorizationList?: undefined | undefined;
277
277
  hash: import("viem").Hash;
278
278
  input: import("viem").Hex;
@@ -290,14 +290,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
290
290
  s: import("viem").Hex;
291
291
  nonce: number;
292
292
  type: "eip1559";
293
- yParity: number;
294
293
  gas: bigint;
295
- maxFeePerBlobGas?: undefined | undefined;
294
+ yParity: number;
295
+ blobVersionedHashes?: undefined | undefined;
296
296
  gasPrice?: undefined | undefined;
297
+ maxFeePerBlobGas?: undefined | undefined;
297
298
  maxFeePerGas: bigint;
298
299
  maxPriorityFeePerGas: bigint;
299
300
  accessList: import("viem").AccessList;
300
- blobVersionedHashes?: undefined | undefined;
301
301
  authorizationList?: undefined | undefined;
302
302
  hash: import("viem").Hash;
303
303
  input: import("viem").Hex;
@@ -315,14 +315,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
315
315
  s: import("viem").Hex;
316
316
  nonce: number;
317
317
  type: "eip4844";
318
- yParity: number;
319
318
  gas: bigint;
320
- maxFeePerBlobGas: bigint;
319
+ yParity: number;
320
+ blobVersionedHashes: readonly import("viem").Hex[];
321
321
  gasPrice?: undefined | undefined;
322
+ maxFeePerBlobGas: bigint;
322
323
  maxFeePerGas: bigint;
323
324
  maxPriorityFeePerGas: bigint;
324
325
  accessList: import("viem").AccessList;
325
- blobVersionedHashes: readonly import("viem").Hex[];
326
326
  authorizationList?: undefined | undefined;
327
327
  hash: import("viem").Hash;
328
328
  input: import("viem").Hex;
@@ -340,14 +340,14 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
340
340
  s: import("viem").Hex;
341
341
  nonce: number;
342
342
  type: "eip7702";
343
- yParity: number;
344
343
  gas: bigint;
345
- maxFeePerBlobGas?: undefined | undefined;
344
+ yParity: number;
345
+ blobVersionedHashes?: undefined | undefined;
346
346
  gasPrice?: undefined | undefined;
347
+ maxFeePerBlobGas?: undefined | undefined;
347
348
  maxFeePerGas: bigint;
348
349
  maxPriorityFeePerGas: bigint;
349
350
  accessList: import("viem").AccessList;
350
- blobVersionedHashes?: undefined | undefined;
351
351
  authorizationList: import("viem").SignedAuthorizationList;
352
352
  hash: import("viem").Hash;
353
353
  input: import("viem").Hex;
@@ -3612,7 +3612,7 @@ export declare const getPublicClient: ({ rpcUrls, chainId }: {
3612
3612
  authorizationList: import("viem").TransactionSerializableEIP7702["authorizationList"];
3613
3613
  } ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract<request["type"], string> : never)>) ? T_12 extends "eip7702" ? import("viem").TransactionRequestEIP7702 : never : never : never)>> & {
3614
3614
  chainId?: number | undefined;
3615
- }, (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "chainId" | "nonce" | "type" | "gas" | "blobVersionedHashes" | "fees") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "chainId" | "nonce" | "type" | "gas" | "blobVersionedHashes" | "fees") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) extends infer T ? { [K in keyof T]: T[K]; } : never>;
3615
+ }, (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "chainId" | "nonce" | "type" | "fees" | "gas" | "blobVersionedHashes") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "chainId" | "nonce" | "type" | "fees" | "gas" | "blobVersionedHashes") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick<request, "kzg">) extends infer T ? { [K in keyof T]: T[K]; } : never>;
3616
3616
  readContract: <const abi extends Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi, "pure" | "view">, const args extends import("viem").ContractFunctionArgs<abi, "pure" | "view", functionName>>(args: import("viem").ReadContractParameters<abi, functionName, args>) => Promise<import("viem").ReadContractReturnType<abi, functionName, args>>;
3617
3617
  sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise<import("viem").SendRawTransactionReturnType>;
3618
3618
  simulate: <const calls extends readonly unknown[]>(args: import("viem").SimulateBlocksParameters<calls>) => Promise<import("viem").SimulateBlocksReturnType<calls>>;
@@ -0,0 +1,11 @@
1
+ import { StatusCodes, TxnStatus } from '../../enums';
2
+ import { HexString } from '../../types';
3
+ import { CustomTypedDataParams } from '../../types/permit';
4
+ export declare const signCustomTypedData: (params: CustomTypedDataParams) => Promise<{
5
+ status: TxnStatus;
6
+ code: StatusCodes;
7
+ data?: {
8
+ signature: HexString;
9
+ message: Record<string, any>;
10
+ };
11
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzapio/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A TypeScript/JavaScript SDK for interacting with the DZap protocol, providing utilities for DeFi operations including Swaps, Bridges, and Zaps.",
5
5
  "main": "dist/index.js",
6
6
  "source": "src/index.ts",
@@ -1,2 +0,0 @@
1
- import * as viemChains from 'viem/chains';
2
- export declare const viemChainsById: Record<number, viemChains.Chain>;