@1stdex/first-sdk 1.0.83 → 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.
@@ -1,6 +1,14 @@
1
1
  import { CHAIN_IDS } from '../../constants/chain-configs/chain';
2
2
  import { DefaultWriteContractOptions } from '../../types';
3
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
+ }
4
12
  /**
5
13
  * Prepares transactions to claim real tokens from a mirror token system.
6
14
  * Checks vault claimable assets and mirror token claimable assets, then creates
@@ -36,14 +44,16 @@ export declare const prepareClaimRealTokensSameChain: ({ chainId, userAddress, m
36
44
  }) => Promise<BatchCall[]>;
37
45
  /**
38
46
  * Prepares transactions to claim real tokens and bridge them cross-chain via LayerZero.
39
- * Claims all available assets to the user address, then bridges them to a receiving
40
- * address on the destination chain using LayerZero's OFT protocol.
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.
41
50
  *
42
51
  * @param chainId The source chain ID.
43
52
  * @param destinationChainId The destination chain ID.
44
53
  * @param userAddress The user address.
45
54
  * @param mirrorTokenAddress The mirror token address (OFT contract).
46
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).
47
57
  * @param options Optional parameters.
48
58
  * @returns Promise resolving to array of batch calls.
49
59
  * @example
@@ -55,19 +65,21 @@ export declare const prepareClaimRealTokensSameChain: ({ chainId, userAddress, m
55
65
  * destinationChainId: 8453,
56
66
  * userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
57
67
  * mirrorTokenAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
58
- * receivingAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
68
+ * receivingAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
69
+ * amount: 1000000000000000000n // 1 token (18 decimals)
59
70
  * })
60
71
  *
61
72
  * // Send all calls in one batched transaction
62
73
  * const { client } = useSmartWallets()
63
74
  * const txHash = await client.sendUserOperation({ calls })
64
75
  */
65
- export declare const prepareClaimRealTokensCrossChainLZ: ({ chainId, destinationChainId, userAddress, mirrorTokenAddress, receivingAddress, options, }: {
76
+ export declare const prepareClaimRealTokensCrossChainLZ: ({ chainId, destinationChainId, userAddress, mirrorTokenAddress, receivingAddress, amount, options, }: {
66
77
  chainId: CHAIN_IDS;
67
78
  destinationChainId: CHAIN_IDS;
68
79
  userAddress: `0x${string}`;
69
80
  mirrorTokenAddress: `0x${string}`;
70
81
  receivingAddress: `0x${string}`;
82
+ amount: bigint;
71
83
  options?: DefaultWriteContractOptions;
72
84
  }) => Promise<BatchCall[]>;
73
85
  //# sourceMappingURL=prepare-claim-real-tokens.d.ts.map
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;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,2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O,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1stdex/first-sdk",
3
- "version": "1.0.83",
3
+ "version": "1.0.84",
4
4
  "description": "🛠 An SDK for building applications on top of 1st V2",
5
5
  "files": [
6
6
  "dist"