@1stdex/first-sdk 1.0.82 → 1.0.84

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.
Files changed (28) hide show
  1. package/dist/cjs/calls/batch/index.js +4 -1
  2. package/dist/cjs/calls/batch/index.js.map +1 -1
  3. package/dist/cjs/calls/batch/prepare-claim-real-tokens.js +188 -0
  4. package/dist/cjs/calls/batch/prepare-claim-real-tokens.js.map +1 -0
  5. package/dist/cjs/constants/abis/core/first_oft.js +1680 -0
  6. package/dist/cjs/constants/abis/core/first_oft.js.map +1 -0
  7. package/dist/cjs/constants/chain-configs/eids.js +11 -0
  8. package/dist/cjs/constants/chain-configs/eids.js.map +1 -0
  9. package/dist/cjs/views/balance.js +2 -2
  10. package/dist/esm/calls/batch/index.js +1 -0
  11. package/dist/esm/calls/batch/index.js.map +1 -1
  12. package/dist/esm/calls/batch/prepare-claim-real-tokens.js +255 -0
  13. package/dist/esm/calls/batch/prepare-claim-real-tokens.js.map +1 -0
  14. package/dist/esm/constants/abis/core/first_oft.js +1677 -0
  15. package/dist/esm/constants/abis/core/first_oft.js.map +1 -0
  16. package/dist/esm/constants/chain-configs/eids.js +11 -0
  17. package/dist/esm/constants/chain-configs/eids.js.map +1 -0
  18. package/dist/esm/views/balance.js +2 -2
  19. package/dist/tsconfig.build.tsbuildinfo +1 -1
  20. package/dist/types/calls/batch/index.d.ts +1 -0
  21. package/dist/types/calls/batch/index.d.ts.map +1 -1
  22. package/dist/types/calls/batch/prepare-claim-real-tokens.d.ts +85 -0
  23. package/dist/types/calls/batch/prepare-claim-real-tokens.d.ts.map +1 -0
  24. package/dist/types/constants/abis/core/first_oft.d.ts +1286 -0
  25. package/dist/types/constants/abis/core/first_oft.d.ts.map +1 -0
  26. package/dist/types/constants/chain-configs/eids.d.ts +8 -0
  27. package/dist/types/constants/chain-configs/eids.d.ts.map +1 -0
  28. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  export { prepareLimitOrderWithSetup } from './prepare-limit-order-with-setup';
2
2
  export { prepareMarketOrderWithSetup } from './prepare-market-order-with-setup';
3
3
  export { prepareWithdraw, NotEnoughFundsError } from './prepare-withdraw';
4
+ export { prepareClaimRealTokensSameChain, prepareClaimRealTokensCrossChainLZ, } from './prepare-claim-real-tokens';
4
5
  export type { BatchCall } from './prepare-limit-order-with-setup';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calls/batch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calls/batch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { CHAIN_IDS } from '../../constants/chain-configs/chain';
2
+ import { DefaultWriteContractOptions } from '../../types';
3
+ import { BatchCall } from './prepare-limit-order-with-setup';
4
+ /**
5
+ * Error thrown when there are insufficient claimable funds in vault and mirror token combined.
6
+ */
7
+ export declare class NotEnoughClaimableError extends Error {
8
+ readonly required: bigint;
9
+ readonly available: bigint;
10
+ constructor(message: string, required: bigint, available: bigint);
11
+ }
12
+ /**
13
+ * Prepares transactions to claim real tokens from a mirror token system.
14
+ * Checks vault claimable assets and mirror token claimable assets, then creates
15
+ * claim calls to transfer all available real tokens to the receiving address.
16
+ *
17
+ * @param chainId The chain ID.
18
+ * @param userAddress The user address.
19
+ * @param mirrorTokenAddress The mirror token address.
20
+ * @param receivingAddress The address to receive the claimed real tokens.
21
+ * @param options Optional parameters.
22
+ * @returns Promise resolving to array of batch calls.
23
+ * @example
24
+ * import { prepareClaimRealTokensSameChain } from '@1stdex/first-sdk'
25
+ * import { useSmartWallets } from '@privy-io/react-auth/smart-wallets'
26
+ *
27
+ * const calls = await prepareClaimRealTokensSameChain({
28
+ * chainId: 421614,
29
+ * userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
30
+ * mirrorTokenAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
31
+ * receivingAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
32
+ * })
33
+ *
34
+ * // Send all calls in one batched transaction
35
+ * const { client } = useSmartWallets()
36
+ * const txHash = await client.sendUserOperation({ calls })
37
+ */
38
+ export declare const prepareClaimRealTokensSameChain: ({ chainId, userAddress, mirrorTokenAddress, receivingAddress, options, }: {
39
+ chainId: CHAIN_IDS;
40
+ userAddress: `0x${string}`;
41
+ mirrorTokenAddress: `0x${string}`;
42
+ receivingAddress: `0x${string}`;
43
+ options?: DefaultWriteContractOptions;
44
+ }) => Promise<BatchCall[]>;
45
+ /**
46
+ * Prepares transactions to claim real tokens and bridge them cross-chain via LayerZero.
47
+ * Claims the specified amount optimally (from mirror token and/or vault) to the user address,
48
+ * then bridges them to a receiving address on the destination chain using LayerZero's OFT protocol.
49
+ * Throws NotEnoughClaimableError if combined claimable amount is insufficient.
50
+ *
51
+ * @param chainId The source chain ID.
52
+ * @param destinationChainId The destination chain ID.
53
+ * @param userAddress The user address.
54
+ * @param mirrorTokenAddress The mirror token address (OFT contract).
55
+ * @param receivingAddress The address to receive the tokens on destination chain.
56
+ * @param amount The amount to claim and send (in token base units, e.g., wei).
57
+ * @param options Optional parameters.
58
+ * @returns Promise resolving to array of batch calls.
59
+ * @example
60
+ * import { prepareClaimRealTokensCrossChainLZ } from '@1stdex/first-sdk'
61
+ * import { useSmartWallets } from '@privy-io/react-auth/smart-wallets'
62
+ *
63
+ * const calls = await prepareClaimRealTokensCrossChainLZ({
64
+ * chainId: 84532,
65
+ * destinationChainId: 8453,
66
+ * userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
67
+ * mirrorTokenAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
68
+ * receivingAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
69
+ * amount: 1000000000000000000n // 1 token (18 decimals)
70
+ * })
71
+ *
72
+ * // Send all calls in one batched transaction
73
+ * const { client } = useSmartWallets()
74
+ * const txHash = await client.sendUserOperation({ calls })
75
+ */
76
+ export declare const prepareClaimRealTokensCrossChainLZ: ({ chainId, destinationChainId, userAddress, mirrorTokenAddress, receivingAddress, amount, options, }: {
77
+ chainId: CHAIN_IDS;
78
+ destinationChainId: CHAIN_IDS;
79
+ userAddress: `0x${string}`;
80
+ mirrorTokenAddress: `0x${string}`;
81
+ receivingAddress: `0x${string}`;
82
+ amount: bigint;
83
+ options?: DefaultWriteContractOptions;
84
+ }) => Promise<BatchCall[]>;
85
+ //# sourceMappingURL=prepare-claim-real-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare-claim-real-tokens.d.ts","sourceRoot":"","sources":["../../../../src/calls/batch/prepare-claim-real-tokens.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAa,MAAM,qCAAqC,CAAC;AAM3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAG9B,QAAQ,EAAE,MAAM;aAChB,SAAS,EAAE,MAAM;gBAFjC,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;CAMpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,+BAA+B,6EAMzC;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,kBAAkB,EAAE,KAAK,MAAM,EAAE,CAAC;IAClC,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACvC,KAAG,QAAQ,SAAS,EAAE,CAkEtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,kCAAkC,yGAQ5C;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,kBAAkB,EAAE,SAAS,CAAC;IAC9B,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,kBAAkB,EAAE,KAAK,MAAM,EAAE,CAAC;IAClC,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACvC,KAAG,QAAQ,SAAS,EAAE,CAkItB,CAAC"}