@clober/v2-sdk 0.0.25-dev → 0.0.25

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.
@@ -30,4 +30,38 @@ export declare const setApprovalOfOpenOrdersForAll: (args: {
30
30
  walletClient: WalletClient;
31
31
  options?: DefaultOptions;
32
32
  }) => Promise<`0x${string}` | undefined>;
33
+ /**
34
+ * @dev This function relates with `viem` dependency
35
+ * Approves the specified amount of tokens for the given account on the specified chain.
36
+ *
37
+ * @param {CHAIN_IDS} chainId The chain ID.
38
+ * @param {WalletClient} walletClient The wallet client.
39
+ * @param {`0x${string}`} token The ERC20 token address.
40
+ * @param {string} amount The amount of tokens to permit.
41
+ * @param options
42
+ * @param options.rpcUrl The RPC URL of the blockchain.
43
+ * @returns {Promise<`0x${string}` | undefined>} Promise resolving to the transaction hash. If the account is already approved, the promise resolves to `undefined`.
44
+ * @example
45
+ * import { approve20 } from '@clober/v2-sdk'
46
+ *
47
+ * const walletClient = createWalletClient({
48
+ * chain: arbitrumSepolia,
49
+ * account: mnemonicToAccount('legal ...'),
50
+ * transport: http(),
51
+ * })
52
+ *
53
+ * const hash = await approve20({
54
+ * chainId: 421614,
55
+ * walletClient
56
+ * token: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
57
+ * amount: '1000.123', // approve 1000.123 USDC
58
+ * })
59
+ */
60
+ export declare const approve20: (args: {
61
+ chainId: CHAIN_IDS;
62
+ walletClient: WalletClient;
63
+ token: `0x${string}`;
64
+ amount: string;
65
+ options?: DefaultOptions;
66
+ }) => Promise<`0x${string}` | undefined>;
33
67
  //# sourceMappingURL=approval.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B;aAK7B,SAAS;kBACJ,YAAY;cAChB,cAAc;wCAqB3B,CAAA"}
1
+ {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,MAAM,CAAA;AAE/C,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAI5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B;aAK7B,SAAS;kBACJ,YAAY;cAChB,cAAc;wCAwC3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,SAAS;aAOT,SAAS;kBACJ,YAAY;WACnB,KAAK,MAAM,EAAE;YACZ,MAAM;cACJ,cAAc;wCAsD3B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { CHAIN_IDS } from '../constants/chain';
2
+ export declare function fetchAllowance(chainId: CHAIN_IDS, token: `0x${string}`, userAddress: `0x${string}`, spenderAddress: `0x${string}`): Promise<bigint>;
3
+ //# sourceMappingURL=allowance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowance.d.ts","sourceRoot":"","sources":["../../../src/utils/allowance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AA6B9C,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,MAAM,EAAE,EACpB,WAAW,EAAE,KAAK,MAAM,EAAE,EAC1B,cAAc,EAAE,KAAK,MAAM,EAAE,GAC5B,OAAO,CAAC,MAAM,CAAC,CAOjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clober/v2-sdk",
3
- "version": "0.0.25-dev",
3
+ "version": "0.0.25",
4
4
  "description": "🛠 An SDK for building applications on top of Clober V2",
5
5
  "files": [
6
6
  "dist"