@circle-fin/provider-cctp-v2 1.8.0 → 1.8.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.
- package/CHANGELOG.md +12 -0
- package/index.cjs +35 -12
- package/index.d.ts +85 -4
- package/index.mjs +35 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @circle-fin/provider-cctp-v2
|
|
2
2
|
|
|
3
|
+
## 1.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Internal dependency updates. No user-facing changes.
|
|
8
|
+
|
|
9
|
+
## 1.8.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Internal dependency updates. No user-facing changes.
|
|
14
|
+
|
|
3
15
|
## 1.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/index.cjs
CHANGED
|
@@ -400,23 +400,21 @@ var UnifiedBalanceChain;
|
|
|
400
400
|
* Enumeration of blockchains that support earn (vault deposit/withdraw)
|
|
401
401
|
* operations through the Earn Kit.
|
|
402
402
|
*
|
|
403
|
-
* Currently only Ethereum mainnet is supported. Additional chains
|
|
404
|
-
* will be added as vault protocol support expands.
|
|
405
|
-
*
|
|
406
403
|
* @example
|
|
407
404
|
* ```typescript
|
|
408
405
|
* import { EarnChain } from '@core/chains'
|
|
409
406
|
*
|
|
410
407
|
* const result = await earnKit.deposit({
|
|
411
|
-
* from: { adapter, chain: EarnChain.
|
|
408
|
+
* from: { adapter, chain: EarnChain.Arc_Testnet },
|
|
412
409
|
* vaultAddress: '0x...',
|
|
413
410
|
* amount: '100',
|
|
414
411
|
* })
|
|
415
412
|
* ```
|
|
416
413
|
*/
|
|
414
|
+
// Values must match Blockchain enum members exactly.
|
|
417
415
|
var EarnChain;
|
|
418
416
|
(function (EarnChain) {
|
|
419
|
-
EarnChain["
|
|
417
|
+
EarnChain["Arc_Testnet"] = "Arc_Testnet";
|
|
420
418
|
})(EarnChain || (EarnChain = {}));
|
|
421
419
|
|
|
422
420
|
/**
|
|
@@ -4094,7 +4092,7 @@ zod.z.union([
|
|
|
4094
4092
|
* Zod schema for validating earn-specific chain identifiers.
|
|
4095
4093
|
*
|
|
4096
4094
|
* Validate that the provided chain is supported for earn (vault
|
|
4097
|
-
* deposit/withdraw) operations. Currently only
|
|
4095
|
+
* deposit/withdraw) operations. Currently only Arc Testnet is
|
|
4098
4096
|
* supported.
|
|
4099
4097
|
*
|
|
4100
4098
|
* Accept an EarnChain enum value, a matching string literal, or
|
|
@@ -4103,12 +4101,12 @@ zod.z.union([
|
|
|
4103
4101
|
* @example
|
|
4104
4102
|
* ```typescript
|
|
4105
4103
|
* import { earnChainIdentifierSchema } from '@core/chains'
|
|
4106
|
-
* import {
|
|
4104
|
+
* import { ArcTestnet, EarnChain } from '@core/chains'
|
|
4107
4105
|
*
|
|
4108
4106
|
* // Valid
|
|
4109
|
-
* earnChainIdentifierSchema.parse(EarnChain.
|
|
4110
|
-
* earnChainIdentifierSchema.parse('
|
|
4111
|
-
* earnChainIdentifierSchema.parse(
|
|
4107
|
+
* earnChainIdentifierSchema.parse(EarnChain.Arc_Testnet)
|
|
4108
|
+
* earnChainIdentifierSchema.parse('Arc_Testnet')
|
|
4109
|
+
* earnChainIdentifierSchema.parse(ArcTestnet)
|
|
4112
4110
|
*
|
|
4113
4111
|
* // Invalid (throws ZodError)
|
|
4114
4112
|
* earnChainIdentifierSchema.parse('Solana')
|
|
@@ -12248,7 +12246,7 @@ async function buildBatchedStep(name, receipt, batchId, adapter, chain, statusCo
|
|
|
12248
12246
|
return step;
|
|
12249
12247
|
}
|
|
12250
12248
|
|
|
12251
|
-
var version = "1.8.
|
|
12249
|
+
var version = "1.8.2";
|
|
12252
12250
|
var pkg = {
|
|
12253
12251
|
version: version};
|
|
12254
12252
|
|
|
@@ -12662,7 +12660,9 @@ const hexStringSchema = zod.z
|
|
|
12662
12660
|
* console.log(result.success) // true
|
|
12663
12661
|
* ```
|
|
12664
12662
|
*/
|
|
12665
|
-
hexStringSchema
|
|
12663
|
+
hexStringSchema
|
|
12664
|
+
.refine((value) => value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)')
|
|
12665
|
+
.transform((value) => value);
|
|
12666
12666
|
/**
|
|
12667
12667
|
* Schema for validating transaction hashes.
|
|
12668
12668
|
*
|
|
@@ -12683,6 +12683,29 @@ hexStringSchema.refine((value) => value.length === 42, 'EVM address must be exac
|
|
|
12683
12683
|
* ```
|
|
12684
12684
|
*/
|
|
12685
12685
|
hexStringSchema.refine((value) => value.length === 66, 'Transaction hash must be exactly 66 characters long (0x + 64 hex characters)');
|
|
12686
|
+
/**
|
|
12687
|
+
* Schema for validating EVM signatures.
|
|
12688
|
+
*
|
|
12689
|
+
* This schema validates that a string is a properly formatted 65-byte EVM
|
|
12690
|
+
* signature:
|
|
12691
|
+
* - Must be a valid hex string with '0x' prefix
|
|
12692
|
+
* - Must be exactly 132 characters long (0x + 130 hex characters)
|
|
12693
|
+
*
|
|
12694
|
+
* @throws {KitError} If validation fails with INPUT_VALIDATION_FAILED code (1098), with details about which properties failed
|
|
12695
|
+
*
|
|
12696
|
+
* @example
|
|
12697
|
+
* ```typescript
|
|
12698
|
+
* import { evmSignatureSchema } from '@core/adapter'
|
|
12699
|
+
*
|
|
12700
|
+
* const validSignature = `0x${'ab'.repeat(65)}`
|
|
12701
|
+
*
|
|
12702
|
+
* const result = evmSignatureSchema.safeParse(validSignature)
|
|
12703
|
+
* console.log(result.success) // true
|
|
12704
|
+
* ```
|
|
12705
|
+
*/
|
|
12706
|
+
hexStringSchema
|
|
12707
|
+
.refine((value) => value.length === 132, 'EVM signature must be exactly 132 characters long (0x + 130 hex characters)')
|
|
12708
|
+
.transform((value) => value);
|
|
12686
12709
|
/**
|
|
12687
12710
|
* Schema for validating base58-encoded strings.
|
|
12688
12711
|
*
|
package/index.d.ts
CHANGED
|
@@ -1810,12 +1810,14 @@ declare enum PermitType {
|
|
|
1810
1810
|
* The Adapter Contract uses this to pull tokens from the user's wallet
|
|
1811
1811
|
* using permit signatures instead of requiring separate approval transactions.
|
|
1812
1812
|
*
|
|
1813
|
+
* Shared by the `swap.*` and `earn.*` action namespaces because both forward
|
|
1814
|
+
* `tokenInputs` unchanged to the adapter contract's `execute` call.
|
|
1815
|
+
*
|
|
1813
1816
|
* @example
|
|
1814
1817
|
* ```typescript
|
|
1815
1818
|
* const tokenInput: TokenInput = {
|
|
1816
1819
|
* permitType: PermitType.EIP2612,
|
|
1817
1820
|
* token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
1818
|
-
* from: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
|
|
1819
1821
|
* amount: 1000000n, // 1 USDC
|
|
1820
1822
|
* permitCalldata: '0x...' // Encoded permit(value, deadline, v, r, s)
|
|
1821
1823
|
* }
|
|
@@ -1838,12 +1840,91 @@ interface TokenInput {
|
|
|
1838
1840
|
* ABI-encoded permit calldata.
|
|
1839
1841
|
*
|
|
1840
1842
|
* For EIP-2612: encode(value, deadline, v, r, s)
|
|
1841
|
-
* For Permit2: encode(permit, signature)
|
|
1842
1843
|
*
|
|
1843
1844
|
* @example '0x0000000000000000000000000000000000000000000000000000000000989680...'
|
|
1844
1845
|
*/
|
|
1845
1846
|
permitCalldata: `0x${string}`;
|
|
1846
1847
|
}
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Parameters for executing a service-signed earn operation via the Adapter
|
|
1851
|
+
* smart contract on EVM chains.
|
|
1852
|
+
*
|
|
1853
|
+
* Shared across earn action keys: `earn.deposit`, `earn.withdraw`, and
|
|
1854
|
+
* `earn.claimRewards`. Each operation forwards the same `executeParams`,
|
|
1855
|
+
* `tokenInputs`, and `signature` triple to the adapter contract's `execute`
|
|
1856
|
+
* function. The service signs `executeParams` off-chain; the contract verifies
|
|
1857
|
+
* the signature on-chain.
|
|
1858
|
+
*
|
|
1859
|
+
* @example
|
|
1860
|
+
* ```typescript
|
|
1861
|
+
* import type { ActionPayload } from '@core/adapter'
|
|
1862
|
+
*
|
|
1863
|
+
* const params: ActionPayload<'earn.deposit'> = {
|
|
1864
|
+
* executeParams: { instructions: [], tokens: [], execId: 1n, deadline: 0n, metadata: '0x' },
|
|
1865
|
+
* tokenInputs: [],
|
|
1866
|
+
* signature: '0x...',
|
|
1867
|
+
* }
|
|
1868
|
+
*
|
|
1869
|
+
* const prepared = await adapter.prepareAction('earn.deposit', params, { chain, address })
|
|
1870
|
+
* const txHash = await prepared.execute()
|
|
1871
|
+
* ```
|
|
1872
|
+
*/
|
|
1873
|
+
interface ExecuteEarnEVMParams extends ActionParameters {
|
|
1874
|
+
/**
|
|
1875
|
+
* Execution parameters returned by the earn service.
|
|
1876
|
+
*
|
|
1877
|
+
* Kept as an opaque record so the adapter forwards the service-signed struct
|
|
1878
|
+
* unchanged. The adapter contract ABI decodes it on-chain.
|
|
1879
|
+
*/
|
|
1880
|
+
executeParams: Record<string, unknown>;
|
|
1881
|
+
/**
|
|
1882
|
+
* Token inputs with permit signatures for gasless approvals.
|
|
1883
|
+
*
|
|
1884
|
+
* Populated by the earn provider after it decides how token spending is
|
|
1885
|
+
* authorised. Today deposit uses a separate `token.approve` transaction and
|
|
1886
|
+
* passes `PermitType.NONE`; a future permit-enabled path can populate this
|
|
1887
|
+
* field without a breaking change.
|
|
1888
|
+
*/
|
|
1889
|
+
tokenInputs: TokenInput[];
|
|
1890
|
+
/**
|
|
1891
|
+
* EIP-712 signature from the earn service proxy.
|
|
1892
|
+
*
|
|
1893
|
+
* The adapter contract verifies this signature on-chain. Passed through
|
|
1894
|
+
* unchanged.
|
|
1895
|
+
*/
|
|
1896
|
+
signature: `0x${string}`;
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Parameters for earn execute actions across supported ecosystems.
|
|
1900
|
+
*
|
|
1901
|
+
* EVM-only today; becomes a union when a non-EVM adapter implementation
|
|
1902
|
+
* lands. Action handlers narrow via a property-based type guard, same
|
|
1903
|
+
* pattern as {@link ExecuteSwapParams}.
|
|
1904
|
+
*/
|
|
1905
|
+
type ExecuteEarnParams = ExecuteEarnEVMParams;
|
|
1906
|
+
/**
|
|
1907
|
+
* Action map for earn operations.
|
|
1908
|
+
*
|
|
1909
|
+
* Each action key forwards the same `(executeParams, tokenInputs, signature)`
|
|
1910
|
+
* triple to the adapter contract. Provider-side orchestration performs any
|
|
1911
|
+
* required token approval; this action only prepares the adapter execute call.
|
|
1912
|
+
*/
|
|
1913
|
+
interface EarnActionMap {
|
|
1914
|
+
/**
|
|
1915
|
+
* Execute a service-signed deposit against the adapter contract.
|
|
1916
|
+
*/
|
|
1917
|
+
readonly deposit: ExecuteEarnParams;
|
|
1918
|
+
/**
|
|
1919
|
+
* Execute a service-signed withdraw against the adapter contract.
|
|
1920
|
+
*/
|
|
1921
|
+
readonly withdraw: ExecuteEarnParams;
|
|
1922
|
+
/**
|
|
1923
|
+
* Execute a service-signed claim rewards against the adapter contract.
|
|
1924
|
+
*/
|
|
1925
|
+
readonly claimRewards: ExecuteEarnParams;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1847
1928
|
/**
|
|
1848
1929
|
* Single instruction to execute within the Adapter Contract.
|
|
1849
1930
|
*
|
|
@@ -2025,7 +2106,6 @@ interface ExecuteParams {
|
|
|
2025
2106
|
* const tokenInputs: TokenInput[] = [{
|
|
2026
2107
|
* permitType: PermitType.EIP2612,
|
|
2027
2108
|
* token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
2028
|
-
* from: userAddress,
|
|
2029
2109
|
* amount: 1000000n,
|
|
2030
2110
|
* permitCalldata: '0x...' // Encoded permit signature
|
|
2031
2111
|
* }]
|
|
@@ -2068,7 +2148,6 @@ interface ExecuteSwapEVMParams extends ActionParameters {
|
|
|
2068
2148
|
* [{
|
|
2069
2149
|
* permitType: PermitType.EIP2612,
|
|
2070
2150
|
* token: '0xUSDC',
|
|
2071
|
-
* from: userAddress,
|
|
2072
2151
|
* amount: 1000000n,
|
|
2073
2152
|
* permitCalldata: '0x...'
|
|
2074
2153
|
* }]
|
|
@@ -2804,6 +2883,8 @@ interface ActionMap {
|
|
|
2804
2883
|
readonly usdt: USDTActionMap;
|
|
2805
2884
|
/** Swap operations for DEX aggregator integrations. */
|
|
2806
2885
|
readonly swap: SwapActionMap;
|
|
2886
|
+
/** Earn operations that execute service-signed payloads via the adapter contract. */
|
|
2887
|
+
readonly earn: EarnActionMap;
|
|
2807
2888
|
}
|
|
2808
2889
|
/**
|
|
2809
2890
|
* Determine if a type represents an action parameter object (leaf node).
|
package/index.mjs
CHANGED
|
@@ -393,23 +393,21 @@ var UnifiedBalanceChain;
|
|
|
393
393
|
* Enumeration of blockchains that support earn (vault deposit/withdraw)
|
|
394
394
|
* operations through the Earn Kit.
|
|
395
395
|
*
|
|
396
|
-
* Currently only Ethereum mainnet is supported. Additional chains
|
|
397
|
-
* will be added as vault protocol support expands.
|
|
398
|
-
*
|
|
399
396
|
* @example
|
|
400
397
|
* ```typescript
|
|
401
398
|
* import { EarnChain } from '@core/chains'
|
|
402
399
|
*
|
|
403
400
|
* const result = await earnKit.deposit({
|
|
404
|
-
* from: { adapter, chain: EarnChain.
|
|
401
|
+
* from: { adapter, chain: EarnChain.Arc_Testnet },
|
|
405
402
|
* vaultAddress: '0x...',
|
|
406
403
|
* amount: '100',
|
|
407
404
|
* })
|
|
408
405
|
* ```
|
|
409
406
|
*/
|
|
407
|
+
// Values must match Blockchain enum members exactly.
|
|
410
408
|
var EarnChain;
|
|
411
409
|
(function (EarnChain) {
|
|
412
|
-
EarnChain["
|
|
410
|
+
EarnChain["Arc_Testnet"] = "Arc_Testnet";
|
|
413
411
|
})(EarnChain || (EarnChain = {}));
|
|
414
412
|
|
|
415
413
|
/**
|
|
@@ -4087,7 +4085,7 @@ z.union([
|
|
|
4087
4085
|
* Zod schema for validating earn-specific chain identifiers.
|
|
4088
4086
|
*
|
|
4089
4087
|
* Validate that the provided chain is supported for earn (vault
|
|
4090
|
-
* deposit/withdraw) operations. Currently only
|
|
4088
|
+
* deposit/withdraw) operations. Currently only Arc Testnet is
|
|
4091
4089
|
* supported.
|
|
4092
4090
|
*
|
|
4093
4091
|
* Accept an EarnChain enum value, a matching string literal, or
|
|
@@ -4096,12 +4094,12 @@ z.union([
|
|
|
4096
4094
|
* @example
|
|
4097
4095
|
* ```typescript
|
|
4098
4096
|
* import { earnChainIdentifierSchema } from '@core/chains'
|
|
4099
|
-
* import {
|
|
4097
|
+
* import { ArcTestnet, EarnChain } from '@core/chains'
|
|
4100
4098
|
*
|
|
4101
4099
|
* // Valid
|
|
4102
|
-
* earnChainIdentifierSchema.parse(EarnChain.
|
|
4103
|
-
* earnChainIdentifierSchema.parse('
|
|
4104
|
-
* earnChainIdentifierSchema.parse(
|
|
4100
|
+
* earnChainIdentifierSchema.parse(EarnChain.Arc_Testnet)
|
|
4101
|
+
* earnChainIdentifierSchema.parse('Arc_Testnet')
|
|
4102
|
+
* earnChainIdentifierSchema.parse(ArcTestnet)
|
|
4105
4103
|
*
|
|
4106
4104
|
* // Invalid (throws ZodError)
|
|
4107
4105
|
* earnChainIdentifierSchema.parse('Solana')
|
|
@@ -12241,7 +12239,7 @@ async function buildBatchedStep(name, receipt, batchId, adapter, chain, statusCo
|
|
|
12241
12239
|
return step;
|
|
12242
12240
|
}
|
|
12243
12241
|
|
|
12244
|
-
var version = "1.8.
|
|
12242
|
+
var version = "1.8.2";
|
|
12245
12243
|
var pkg = {
|
|
12246
12244
|
version: version};
|
|
12247
12245
|
|
|
@@ -12655,7 +12653,9 @@ const hexStringSchema = z
|
|
|
12655
12653
|
* console.log(result.success) // true
|
|
12656
12654
|
* ```
|
|
12657
12655
|
*/
|
|
12658
|
-
hexStringSchema
|
|
12656
|
+
hexStringSchema
|
|
12657
|
+
.refine((value) => value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)')
|
|
12658
|
+
.transform((value) => value);
|
|
12659
12659
|
/**
|
|
12660
12660
|
* Schema for validating transaction hashes.
|
|
12661
12661
|
*
|
|
@@ -12676,6 +12676,29 @@ hexStringSchema.refine((value) => value.length === 42, 'EVM address must be exac
|
|
|
12676
12676
|
* ```
|
|
12677
12677
|
*/
|
|
12678
12678
|
hexStringSchema.refine((value) => value.length === 66, 'Transaction hash must be exactly 66 characters long (0x + 64 hex characters)');
|
|
12679
|
+
/**
|
|
12680
|
+
* Schema for validating EVM signatures.
|
|
12681
|
+
*
|
|
12682
|
+
* This schema validates that a string is a properly formatted 65-byte EVM
|
|
12683
|
+
* signature:
|
|
12684
|
+
* - Must be a valid hex string with '0x' prefix
|
|
12685
|
+
* - Must be exactly 132 characters long (0x + 130 hex characters)
|
|
12686
|
+
*
|
|
12687
|
+
* @throws {KitError} If validation fails with INPUT_VALIDATION_FAILED code (1098), with details about which properties failed
|
|
12688
|
+
*
|
|
12689
|
+
* @example
|
|
12690
|
+
* ```typescript
|
|
12691
|
+
* import { evmSignatureSchema } from '@core/adapter'
|
|
12692
|
+
*
|
|
12693
|
+
* const validSignature = `0x${'ab'.repeat(65)}`
|
|
12694
|
+
*
|
|
12695
|
+
* const result = evmSignatureSchema.safeParse(validSignature)
|
|
12696
|
+
* console.log(result.success) // true
|
|
12697
|
+
* ```
|
|
12698
|
+
*/
|
|
12699
|
+
hexStringSchema
|
|
12700
|
+
.refine((value) => value.length === 132, 'EVM signature must be exactly 132 characters long (0x + 130 hex characters)')
|
|
12701
|
+
.transform((value) => value);
|
|
12679
12702
|
/**
|
|
12680
12703
|
* Schema for validating base58-encoded strings.
|
|
12681
12704
|
*
|