@dzapio/sdk 2.0.4 → 2.0.6

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,16 +3,16 @@ import { WalletClient } from 'viem';
3
3
  import { StatusCodes, TxnStatus } from '../enums';
4
4
  import { DZapTransactionResponse, HexString } from '../types';
5
5
  import { ZapBuildTxnRequest } from '../types/zap';
6
- import { ZapStep, ZapTxnDetails } from '../types/zap/step';
6
+ import { ZapStep, ZapEvmTxnDetails } from '../types/zap/step';
7
7
  declare class ZapTxnHandler {
8
8
  static execute: ({ chainId, txnData, signer, }: {
9
9
  chainId: number;
10
- txnData: ZapTxnDetails;
10
+ txnData: ZapEvmTxnDetails;
11
11
  signer: Signer | WalletClient;
12
12
  }) => Promise<DZapTransactionResponse>;
13
13
  static approve: ({ chainId, data, signer }: {
14
14
  chainId: number;
15
- data: ZapTxnDetails;
15
+ data: ZapEvmTxnDetails;
16
16
  signer: Signer | WalletClient;
17
17
  }) => Promise<{
18
18
  status: TxnStatus;
@@ -1,2 +1,3 @@
1
- import { exclusiveChainIds } from '../constants/chains';
1
+ import { chainTypes, exclusiveChainIds } from '../constants/chains';
2
2
  export type ExclusiveChainIds = (typeof exclusiveChainIds)[keyof typeof exclusiveChainIds];
3
+ export type ChainType = keyof typeof chainTypes;
@@ -479,4 +479,11 @@ export type BroadcastTxParams = {
479
479
  chainId: number;
480
480
  txData: BroadcastTxData;
481
481
  };
482
+ export type BroadcastTxResponse = {
483
+ status: TxnStatus.success;
484
+ txnHash: string;
485
+ } | {
486
+ status: Exclude<TxnStatus, typeof TxnStatus.success>;
487
+ message: string;
488
+ };
482
489
  export {};
@@ -1,15 +1,23 @@
1
1
  import { HexString } from '..';
2
+ import { chainTypes } from '../../constants/chains';
2
3
  import { zapStepAction } from '../../zap/constants/step';
3
4
  export type StepAction = keyof typeof zapStepAction;
4
- export type ZapTxnDetails = {
5
+ export type ZapEvmTxnDetails = {
6
+ type: typeof chainTypes.evm;
5
7
  txnId: HexString;
6
8
  callData: HexString;
7
9
  callTo: HexString;
8
10
  value: string;
9
11
  estimatedGas: string;
10
12
  };
11
- export type ZapTransactionStep = {
13
+ export type ZapBvmTxnDetails = {
14
+ type: typeof chainTypes.bvm;
15
+ txnId: HexString;
16
+ data: string;
17
+ };
18
+ export type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails;
19
+ export type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
12
20
  action: StepAction;
13
- data: ZapTxnDetails;
21
+ data: T;
14
22
  };
15
23
  export type ZapStep = ZapTransactionStep;
@@ -9,4 +9,5 @@ export declare const ZAP_ENDPOINTS: {
9
9
  positions: string;
10
10
  buildTx: string;
11
11
  quote: string;
12
+ broadcast: string;
12
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzapio/sdk",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
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",