@circle-fin/app-kit 1.16.0 → 1.17.0
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 +38 -0
- package/borrow.cjs +148 -30
- package/borrow.d.cts +35 -6
- package/borrow.d.mts +35 -6
- package/borrow.d.ts +35 -6
- package/borrow.mjs +148 -30
- package/bridge.cjs +187 -40
- package/bridge.d.cts +35 -6
- package/bridge.d.mts +35 -6
- package/bridge.d.ts +35 -6
- package/bridge.mjs +187 -40
- package/chains.cjs +8 -4
- package/chains.mjs +8 -4
- package/context.d.cts +35 -6
- package/context.d.mts +35 -6
- package/context.d.ts +35 -6
- package/earn.cjs +470 -34
- package/earn.d.cts +35 -6
- package/earn.d.mts +35 -6
- package/earn.d.ts +35 -6
- package/earn.mjs +470 -34
- package/estimateBridge.cjs +187 -40
- package/estimateBridge.d.cts +35 -6
- package/estimateBridge.d.mts +35 -6
- package/estimateBridge.d.ts +35 -6
- package/estimateBridge.mjs +187 -40
- package/estimateSwap.cjs +263 -43
- package/estimateSwap.d.cts +83 -6
- package/estimateSwap.d.mts +83 -6
- package/estimateSwap.d.ts +83 -6
- package/estimateSwap.mjs +263 -43
- package/index.cjs +468 -53
- package/index.d.cts +331 -202
- package/index.d.mts +331 -202
- package/index.d.ts +331 -202
- package/index.mjs +468 -53
- package/package.json +8 -8
- package/server.cjs +33 -7
- package/server.d.cts +29 -10
- package/server.d.mts +29 -10
- package/server.d.ts +29 -10
- package/server.mjs +33 -7
- package/swap.cjs +263 -43
- package/swap.d.cts +83 -6
- package/swap.d.mts +83 -6
- package/swap.d.ts +83 -6
- package/swap.mjs +263 -43
- package/unifiedBalance.cjs +73 -12
- package/unifiedBalance.mjs +73 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@circle-fin/app-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "A one-stop Circle SDK solution for building stablecoin (e.g. USDC) applications, with bridging, swapping, and more on-chain operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"circle",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"module": "./index.mjs",
|
|
37
37
|
"types": "./index.d.cts",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@circle-fin/onramp-kit": "1.0.
|
|
40
|
-
"@circle-fin/unified-balance-kit": "1.8.
|
|
41
|
-
"@circle-fin/provider-gateway-v1": "1.5.
|
|
42
|
-
"@circle-fin/earn-kit": "1.
|
|
43
|
-
"@circle-fin/borrow-kit": "1.
|
|
44
|
-
"@circle-fin/bridge-kit": "1.15.
|
|
45
|
-
"@circle-fin/swap-kit": "1.
|
|
39
|
+
"@circle-fin/onramp-kit": "1.0.4",
|
|
40
|
+
"@circle-fin/unified-balance-kit": "1.8.1",
|
|
41
|
+
"@circle-fin/provider-gateway-v1": "1.5.2",
|
|
42
|
+
"@circle-fin/earn-kit": "1.9.0",
|
|
43
|
+
"@circle-fin/borrow-kit": "1.1.0",
|
|
44
|
+
"@circle-fin/bridge-kit": "1.15.3",
|
|
45
|
+
"@circle-fin/swap-kit": "1.8.0",
|
|
46
46
|
"@coral-xyz/anchor": "^0.31.1",
|
|
47
47
|
"@noble/curves": "1.4.2",
|
|
48
48
|
"bn.js": "^5.2.3",
|
package/server.cjs
CHANGED
|
@@ -1218,6 +1218,8 @@ var SwapChain;
|
|
|
1218
1218
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
1219
1219
|
SwapChain["Monad"] = "Monad";
|
|
1220
1220
|
SwapChain["Arc"] = "Arc";
|
|
1221
|
+
SwapChain["Cronos"] = "Cronos";
|
|
1222
|
+
SwapChain["Morph"] = "Morph";
|
|
1221
1223
|
// Testnet chains with swap support
|
|
1222
1224
|
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
1223
1225
|
})(SwapChain || (SwapChain = {}));
|
|
@@ -2550,7 +2552,8 @@ var BorrowChain;
|
|
|
2550
2552
|
}
|
|
2551
2553
|
},
|
|
2552
2554
|
kitContracts: {
|
|
2553
|
-
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
2555
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
2556
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
2554
2557
|
}
|
|
2555
2558
|
});
|
|
2556
2559
|
|
|
@@ -3419,7 +3422,8 @@ var BorrowChain;
|
|
|
3419
3422
|
}
|
|
3420
3423
|
},
|
|
3421
3424
|
kitContracts: {
|
|
3422
|
-
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
3425
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3426
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
3423
3427
|
}
|
|
3424
3428
|
});
|
|
3425
3429
|
|
|
@@ -5465,8 +5469,8 @@ var BorrowChain;
|
|
|
5465
5469
|
* Zod schema for validating swap-specific chain identifiers.
|
|
5466
5470
|
*
|
|
5467
5471
|
* Validates chains based on:
|
|
5468
|
-
* -
|
|
5469
|
-
* - Mainnet
|
|
5472
|
+
* - Membership in the SwapChain enum
|
|
5473
|
+
* - Mainnet or explicitly allowlisted testnet
|
|
5470
5474
|
* - At least one supported token available
|
|
5471
5475
|
*
|
|
5472
5476
|
*/ zod.z.union([
|
|
@@ -6203,11 +6207,13 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
6203
6207
|
[Blockchain.Arbitrum]: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
|
|
6204
6208
|
[Blockchain.Avalanche]: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
|
|
6205
6209
|
[Blockchain.Celo]: '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
|
|
6210
|
+
[Blockchain.Cronos]: '0x66e428c3f67a68878562e79A0234c1F83c208770',
|
|
6206
6211
|
[Blockchain.Ethereum]: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
6207
6212
|
[Blockchain.HyperEVM]: '0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb',
|
|
6208
6213
|
[Blockchain.Ink]: '0x0200C29006150606B650577BBE7B6248F58470c1',
|
|
6209
6214
|
[Blockchain.Linea]: '0xA219439258ca9da29E9Cc4cE5596924745e12B93',
|
|
6210
6215
|
[Blockchain.Monad]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
6216
|
+
[Blockchain.Morph]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
6211
6217
|
[Blockchain.NEAR]: 'usdt.tether-token.near',
|
|
6212
6218
|
[Blockchain.Optimism]: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
|
|
6213
6219
|
[Blockchain.Polkadot_Asset_Hub]: '1984',
|
|
@@ -6266,6 +6272,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
6266
6272
|
[Blockchain.Arbitrum]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
6267
6273
|
[Blockchain.Avalanche]: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
6268
6274
|
[Blockchain.Base]: '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb',
|
|
6275
|
+
[Blockchain.Cronos]: '0xF2001B145b43032AAF5Ee2884e456CCd805F677D',
|
|
6269
6276
|
[Blockchain.Ethereum]: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
6270
6277
|
[Blockchain.Linea]: '0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5',
|
|
6271
6278
|
[Blockchain.Optimism]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
@@ -6328,7 +6335,9 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
6328
6335
|
[Blockchain.Arbitrum]: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
6329
6336
|
[Blockchain.Avalanche]: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
|
|
6330
6337
|
[Blockchain.Base]: '0x4200000000000000000000000000000000000006',
|
|
6338
|
+
[Blockchain.Cronos]: '0xe44Fd7fCb2b1581822D0c862B68222998a0c299a',
|
|
6331
6339
|
[Blockchain.Ethereum]: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
6340
|
+
[Blockchain.Morph]: '0x5300000000000000000000000000000000000011',
|
|
6332
6341
|
[Blockchain.Optimism]: '0x4200000000000000000000000000000000000006',
|
|
6333
6342
|
[Blockchain.Polygon]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
6334
6343
|
[Blockchain.Solana]: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs'
|
|
@@ -6347,6 +6356,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
6347
6356
|
locators: {
|
|
6348
6357
|
[Blockchain.Ethereum]: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
6349
6358
|
[Blockchain.Arbitrum]: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f',
|
|
6359
|
+
[Blockchain.Cronos]: '0x062E66477Faf219F25D27dCED647BF57C3107d52',
|
|
6350
6360
|
[Blockchain.Avalanche]: '0x50b7545627a5162F82A992c33b87aDc75187B218'
|
|
6351
6361
|
}
|
|
6352
6362
|
};
|
|
@@ -8745,7 +8755,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8745
8755
|
return kit;
|
|
8746
8756
|
}
|
|
8747
8757
|
|
|
8748
|
-
var version = "1.0.
|
|
8758
|
+
var version = "1.0.4";
|
|
8749
8759
|
var pkg = {
|
|
8750
8760
|
version: version};
|
|
8751
8761
|
|
|
@@ -9381,7 +9391,7 @@ function isAbortLikeError(err) {
|
|
|
9381
9391
|
currency: zod.z.string().min(1).optional(),
|
|
9382
9392
|
email: zod.z.string().email().optional(),
|
|
9383
9393
|
assets: onrampAssetSelectionSchema.optional(),
|
|
9384
|
-
metadata: zod.z.record(zod.z.string(), zod.z.
|
|
9394
|
+
metadata: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
9385
9395
|
});
|
|
9386
9396
|
|
|
9387
9397
|
/**
|
|
@@ -9543,7 +9553,7 @@ function isAbortLikeError(err) {
|
|
|
9543
9553
|
const widgetUrl = mergeAssetParams(existingWidgetUrl, composedWidgetUrl, assetParams);
|
|
9544
9554
|
const traceId = typeof session['traceId'] === 'string' ? session['traceId'] : ctx.invocation.traceId;
|
|
9545
9555
|
// Outbound allow-list. We deliberately rebuild the result from the
|
|
9546
|
-
// exact fields the client kit
|
|
9556
|
+
// exact fields the host and client kit consume rather than spreading
|
|
9547
9557
|
// `...session`. Inbound parsing stays schema-free for forward-compat
|
|
9548
9558
|
// (an additive upstream field must never break minting), but the
|
|
9549
9559
|
// server→browser hop is a trust boundary: any internal identifier,
|
|
@@ -9562,6 +9572,11 @@ function isAbortLikeError(err) {
|
|
|
9562
9572
|
if (typeof session['expiresAt'] === 'string') {
|
|
9563
9573
|
normalised['expiresAt'] = session['expiresAt'];
|
|
9564
9574
|
}
|
|
9575
|
+
// From the response only. No fallback to `params.metadata`.
|
|
9576
|
+
const metadata = readMetadataEcho(session['metadata']);
|
|
9577
|
+
if (metadata !== undefined) {
|
|
9578
|
+
normalised['metadata'] = metadata;
|
|
9579
|
+
}
|
|
9565
9580
|
if (widgetUrl === undefined) {
|
|
9566
9581
|
// `widgetUrl` is required on `MintedOnrampSession` (guaranteed
|
|
9567
9582
|
// present). If neither the API returned one nor a `sessionToken`
|
|
@@ -9598,6 +9613,17 @@ function isAbortLikeError(err) {
|
|
|
9598
9613
|
}
|
|
9599
9614
|
return url.toString();
|
|
9600
9615
|
}
|
|
9616
|
+
/**
|
|
9617
|
+
* Copy a plain-object, string-valued `metadata` echo, or drop it whole.
|
|
9618
|
+
*
|
|
9619
|
+
* @internal
|
|
9620
|
+
*/ function readMetadataEcho(value) {
|
|
9621
|
+
if (value === null || typeof value !== 'object' || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
9622
|
+
return undefined;
|
|
9623
|
+
}
|
|
9624
|
+
const entries = Object.entries(value);
|
|
9625
|
+
return entries.every(([, entry])=>typeof entry === 'string') ? Object.fromEntries(entries) : undefined;
|
|
9626
|
+
}
|
|
9601
9627
|
/**
|
|
9602
9628
|
* Translate the SDK parameter shape into the wallets-api request body.
|
|
9603
9629
|
*
|
package/server.d.cts
CHANGED
|
@@ -1801,6 +1801,8 @@ interface KitEventSubscription<M extends EventMap = KitEventMap> {
|
|
|
1801
1801
|
* re-mint.
|
|
1802
1802
|
* - `traceId` — the trace id the server stamped when minting. Echoed
|
|
1803
1803
|
* back so the client can tag widget events with the same id.
|
|
1804
|
+
* - `metadata`: string map echoed on the create response, when the API
|
|
1805
|
+
* sends one. Forwarded to the browser with the rest of the session.
|
|
1804
1806
|
*/
|
|
1805
1807
|
interface OnrampSession {
|
|
1806
1808
|
/**
|
|
@@ -1854,6 +1856,18 @@ interface OnrampSession {
|
|
|
1854
1856
|
* id.
|
|
1855
1857
|
*/
|
|
1856
1858
|
readonly traceId?: string;
|
|
1859
|
+
/**
|
|
1860
|
+
* Request `metadata` as the Onramp API echoed it on the create response.
|
|
1861
|
+
*
|
|
1862
|
+
* @remarks
|
|
1863
|
+
* Present only for a well-formed echo, never copied from the request
|
|
1864
|
+
* params, so absence means the API did not echo it. Returned once: not
|
|
1865
|
+
* sealed into the session token or delivered on later events. A host
|
|
1866
|
+
* that forwards the session to the browser (including via
|
|
1867
|
+
* `createSessionRouteHandler`) also forwards this field, so do not put
|
|
1868
|
+
* server-only values in it.
|
|
1869
|
+
*/
|
|
1870
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
1857
1871
|
/**
|
|
1858
1872
|
* Index signature keeping the type tolerant of additive fields.
|
|
1859
1873
|
*
|
|
@@ -1898,9 +1912,8 @@ interface MintedOnrampSession extends OnrampSession {
|
|
|
1898
1912
|
* contract.
|
|
1899
1913
|
*
|
|
1900
1914
|
* Validation is intentionally conservative: only the fields the kit
|
|
1901
|
-
* actually consumes (or rejects on shape grounds) are checked.
|
|
1902
|
-
*
|
|
1903
|
-
* its own validation on top without the SDK lagging behind.
|
|
1915
|
+
* actually consumes (or rejects on shape grounds) are checked.
|
|
1916
|
+
* `metadata` is a string map. The Onramp API owns its limits.
|
|
1904
1917
|
*
|
|
1905
1918
|
* @packageDocumentation
|
|
1906
1919
|
*/
|
|
@@ -1943,7 +1956,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1943
1956
|
chain: string;
|
|
1944
1957
|
}[] | undefined;
|
|
1945
1958
|
}>>;
|
|
1946
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
1959
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1947
1960
|
}, "strip", z.ZodTypeAny, {
|
|
1948
1961
|
appUserId: string;
|
|
1949
1962
|
destinationAddress: string;
|
|
@@ -1959,7 +1972,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1959
1972
|
chain: string;
|
|
1960
1973
|
}[] | undefined;
|
|
1961
1974
|
} | undefined;
|
|
1962
|
-
metadata?: Record<string,
|
|
1975
|
+
metadata?: Record<string, string> | undefined;
|
|
1963
1976
|
}, {
|
|
1964
1977
|
appUserId: string;
|
|
1965
1978
|
destinationAddress: string;
|
|
@@ -1975,7 +1988,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1975
1988
|
chain: string;
|
|
1976
1989
|
}[] | undefined;
|
|
1977
1990
|
} | undefined;
|
|
1978
|
-
metadata?: Record<string,
|
|
1991
|
+
metadata?: Record<string, string> | undefined;
|
|
1979
1992
|
}>;
|
|
1980
1993
|
/**
|
|
1981
1994
|
* The wire-format request body accepted by the onramp `createSession`
|
|
@@ -1999,8 +2012,11 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1999
2012
|
* - `assets`: optional host-app scoping for the asset selector (which
|
|
2000
2013
|
* token/chain pairs the widget offers). See {@link OnrampAssetSelection}.
|
|
2001
2014
|
* Baked into the launch URL at mint time; never forwarded to wallets-api.
|
|
2002
|
-
* - `metadata`:
|
|
2003
|
-
*
|
|
2015
|
+
* - `metadata`: optional string map. The Onramp API rejects more than 20
|
|
2016
|
+
* keys, keys over 64 characters, values over 1024 characters, and
|
|
2017
|
+
* control characters. It is echoed once on the create response (see
|
|
2018
|
+
* {@link OnrampSession.metadata}) and is not delivered on later widget
|
|
2019
|
+
* events, so use `appUserId` to correlate the user.
|
|
2004
2020
|
*
|
|
2005
2021
|
* Note: the embedding-domain allowlist entry (`referrerDomain`) is **not**
|
|
2006
2022
|
* part of this request. It is a server-only concern configured on
|
|
@@ -2030,8 +2046,11 @@ type OnrampSessionRequest = z.infer<typeof onrampSessionRequestSchema>;
|
|
|
2030
2046
|
* wallets-api. Pass to pre-select a chain in the widget.
|
|
2031
2047
|
* - `amount`, `currency`: optional pre-fills.
|
|
2032
2048
|
* - `email`: optional KYC routing hint.
|
|
2033
|
-
* - `metadata`:
|
|
2034
|
-
*
|
|
2049
|
+
* - `metadata`: optional string map. The Onramp API rejects more than 20
|
|
2050
|
+
* keys, keys over 64 characters, values over 1024 characters, and
|
|
2051
|
+
* control characters. It is echoed once on the create response (see
|
|
2052
|
+
* {@link OnrampSession.metadata}) and is not delivered on later widget
|
|
2053
|
+
* events, so use `appUserId` to correlate the user.
|
|
2035
2054
|
*/
|
|
2036
2055
|
type CreateSessionParams = OnrampSessionRequest;
|
|
2037
2056
|
/**
|
package/server.d.mts
CHANGED
|
@@ -1801,6 +1801,8 @@ interface KitEventSubscription<M extends EventMap = KitEventMap> {
|
|
|
1801
1801
|
* re-mint.
|
|
1802
1802
|
* - `traceId` — the trace id the server stamped when minting. Echoed
|
|
1803
1803
|
* back so the client can tag widget events with the same id.
|
|
1804
|
+
* - `metadata`: string map echoed on the create response, when the API
|
|
1805
|
+
* sends one. Forwarded to the browser with the rest of the session.
|
|
1804
1806
|
*/
|
|
1805
1807
|
interface OnrampSession {
|
|
1806
1808
|
/**
|
|
@@ -1854,6 +1856,18 @@ interface OnrampSession {
|
|
|
1854
1856
|
* id.
|
|
1855
1857
|
*/
|
|
1856
1858
|
readonly traceId?: string;
|
|
1859
|
+
/**
|
|
1860
|
+
* Request `metadata` as the Onramp API echoed it on the create response.
|
|
1861
|
+
*
|
|
1862
|
+
* @remarks
|
|
1863
|
+
* Present only for a well-formed echo, never copied from the request
|
|
1864
|
+
* params, so absence means the API did not echo it. Returned once: not
|
|
1865
|
+
* sealed into the session token or delivered on later events. A host
|
|
1866
|
+
* that forwards the session to the browser (including via
|
|
1867
|
+
* `createSessionRouteHandler`) also forwards this field, so do not put
|
|
1868
|
+
* server-only values in it.
|
|
1869
|
+
*/
|
|
1870
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
1857
1871
|
/**
|
|
1858
1872
|
* Index signature keeping the type tolerant of additive fields.
|
|
1859
1873
|
*
|
|
@@ -1898,9 +1912,8 @@ interface MintedOnrampSession extends OnrampSession {
|
|
|
1898
1912
|
* contract.
|
|
1899
1913
|
*
|
|
1900
1914
|
* Validation is intentionally conservative: only the fields the kit
|
|
1901
|
-
* actually consumes (or rejects on shape grounds) are checked.
|
|
1902
|
-
*
|
|
1903
|
-
* its own validation on top without the SDK lagging behind.
|
|
1915
|
+
* actually consumes (or rejects on shape grounds) are checked.
|
|
1916
|
+
* `metadata` is a string map. The Onramp API owns its limits.
|
|
1904
1917
|
*
|
|
1905
1918
|
* @packageDocumentation
|
|
1906
1919
|
*/
|
|
@@ -1943,7 +1956,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1943
1956
|
chain: string;
|
|
1944
1957
|
}[] | undefined;
|
|
1945
1958
|
}>>;
|
|
1946
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
1959
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1947
1960
|
}, "strip", z.ZodTypeAny, {
|
|
1948
1961
|
appUserId: string;
|
|
1949
1962
|
destinationAddress: string;
|
|
@@ -1959,7 +1972,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1959
1972
|
chain: string;
|
|
1960
1973
|
}[] | undefined;
|
|
1961
1974
|
} | undefined;
|
|
1962
|
-
metadata?: Record<string,
|
|
1975
|
+
metadata?: Record<string, string> | undefined;
|
|
1963
1976
|
}, {
|
|
1964
1977
|
appUserId: string;
|
|
1965
1978
|
destinationAddress: string;
|
|
@@ -1975,7 +1988,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1975
1988
|
chain: string;
|
|
1976
1989
|
}[] | undefined;
|
|
1977
1990
|
} | undefined;
|
|
1978
|
-
metadata?: Record<string,
|
|
1991
|
+
metadata?: Record<string, string> | undefined;
|
|
1979
1992
|
}>;
|
|
1980
1993
|
/**
|
|
1981
1994
|
* The wire-format request body accepted by the onramp `createSession`
|
|
@@ -1999,8 +2012,11 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1999
2012
|
* - `assets`: optional host-app scoping for the asset selector (which
|
|
2000
2013
|
* token/chain pairs the widget offers). See {@link OnrampAssetSelection}.
|
|
2001
2014
|
* Baked into the launch URL at mint time; never forwarded to wallets-api.
|
|
2002
|
-
* - `metadata`:
|
|
2003
|
-
*
|
|
2015
|
+
* - `metadata`: optional string map. The Onramp API rejects more than 20
|
|
2016
|
+
* keys, keys over 64 characters, values over 1024 characters, and
|
|
2017
|
+
* control characters. It is echoed once on the create response (see
|
|
2018
|
+
* {@link OnrampSession.metadata}) and is not delivered on later widget
|
|
2019
|
+
* events, so use `appUserId` to correlate the user.
|
|
2004
2020
|
*
|
|
2005
2021
|
* Note: the embedding-domain allowlist entry (`referrerDomain`) is **not**
|
|
2006
2022
|
* part of this request. It is a server-only concern configured on
|
|
@@ -2030,8 +2046,11 @@ type OnrampSessionRequest = z.infer<typeof onrampSessionRequestSchema>;
|
|
|
2030
2046
|
* wallets-api. Pass to pre-select a chain in the widget.
|
|
2031
2047
|
* - `amount`, `currency`: optional pre-fills.
|
|
2032
2048
|
* - `email`: optional KYC routing hint.
|
|
2033
|
-
* - `metadata`:
|
|
2034
|
-
*
|
|
2049
|
+
* - `metadata`: optional string map. The Onramp API rejects more than 20
|
|
2050
|
+
* keys, keys over 64 characters, values over 1024 characters, and
|
|
2051
|
+
* control characters. It is echoed once on the create response (see
|
|
2052
|
+
* {@link OnrampSession.metadata}) and is not delivered on later widget
|
|
2053
|
+
* events, so use `appUserId` to correlate the user.
|
|
2035
2054
|
*/
|
|
2036
2055
|
type CreateSessionParams = OnrampSessionRequest;
|
|
2037
2056
|
/**
|
package/server.d.ts
CHANGED
|
@@ -1801,6 +1801,8 @@ interface KitEventSubscription<M extends EventMap = KitEventMap> {
|
|
|
1801
1801
|
* re-mint.
|
|
1802
1802
|
* - `traceId` — the trace id the server stamped when minting. Echoed
|
|
1803
1803
|
* back so the client can tag widget events with the same id.
|
|
1804
|
+
* - `metadata`: string map echoed on the create response, when the API
|
|
1805
|
+
* sends one. Forwarded to the browser with the rest of the session.
|
|
1804
1806
|
*/
|
|
1805
1807
|
interface OnrampSession {
|
|
1806
1808
|
/**
|
|
@@ -1854,6 +1856,18 @@ interface OnrampSession {
|
|
|
1854
1856
|
* id.
|
|
1855
1857
|
*/
|
|
1856
1858
|
readonly traceId?: string;
|
|
1859
|
+
/**
|
|
1860
|
+
* Request `metadata` as the Onramp API echoed it on the create response.
|
|
1861
|
+
*
|
|
1862
|
+
* @remarks
|
|
1863
|
+
* Present only for a well-formed echo, never copied from the request
|
|
1864
|
+
* params, so absence means the API did not echo it. Returned once: not
|
|
1865
|
+
* sealed into the session token or delivered on later events. A host
|
|
1866
|
+
* that forwards the session to the browser (including via
|
|
1867
|
+
* `createSessionRouteHandler`) also forwards this field, so do not put
|
|
1868
|
+
* server-only values in it.
|
|
1869
|
+
*/
|
|
1870
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
1857
1871
|
/**
|
|
1858
1872
|
* Index signature keeping the type tolerant of additive fields.
|
|
1859
1873
|
*
|
|
@@ -1898,9 +1912,8 @@ interface MintedOnrampSession extends OnrampSession {
|
|
|
1898
1912
|
* contract.
|
|
1899
1913
|
*
|
|
1900
1914
|
* Validation is intentionally conservative: only the fields the kit
|
|
1901
|
-
* actually consumes (or rejects on shape grounds) are checked.
|
|
1902
|
-
*
|
|
1903
|
-
* its own validation on top without the SDK lagging behind.
|
|
1915
|
+
* actually consumes (or rejects on shape grounds) are checked.
|
|
1916
|
+
* `metadata` is a string map. The Onramp API owns its limits.
|
|
1904
1917
|
*
|
|
1905
1918
|
* @packageDocumentation
|
|
1906
1919
|
*/
|
|
@@ -1943,7 +1956,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1943
1956
|
chain: string;
|
|
1944
1957
|
}[] | undefined;
|
|
1945
1958
|
}>>;
|
|
1946
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
1959
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1947
1960
|
}, "strip", z.ZodTypeAny, {
|
|
1948
1961
|
appUserId: string;
|
|
1949
1962
|
destinationAddress: string;
|
|
@@ -1959,7 +1972,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1959
1972
|
chain: string;
|
|
1960
1973
|
}[] | undefined;
|
|
1961
1974
|
} | undefined;
|
|
1962
|
-
metadata?: Record<string,
|
|
1975
|
+
metadata?: Record<string, string> | undefined;
|
|
1963
1976
|
}, {
|
|
1964
1977
|
appUserId: string;
|
|
1965
1978
|
destinationAddress: string;
|
|
@@ -1975,7 +1988,7 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1975
1988
|
chain: string;
|
|
1976
1989
|
}[] | undefined;
|
|
1977
1990
|
} | undefined;
|
|
1978
|
-
metadata?: Record<string,
|
|
1991
|
+
metadata?: Record<string, string> | undefined;
|
|
1979
1992
|
}>;
|
|
1980
1993
|
/**
|
|
1981
1994
|
* The wire-format request body accepted by the onramp `createSession`
|
|
@@ -1999,8 +2012,11 @@ declare const onrampSessionRequestSchema: z.ZodObject<{
|
|
|
1999
2012
|
* - `assets`: optional host-app scoping for the asset selector (which
|
|
2000
2013
|
* token/chain pairs the widget offers). See {@link OnrampAssetSelection}.
|
|
2001
2014
|
* Baked into the launch URL at mint time; never forwarded to wallets-api.
|
|
2002
|
-
* - `metadata`:
|
|
2003
|
-
*
|
|
2015
|
+
* - `metadata`: optional string map. The Onramp API rejects more than 20
|
|
2016
|
+
* keys, keys over 64 characters, values over 1024 characters, and
|
|
2017
|
+
* control characters. It is echoed once on the create response (see
|
|
2018
|
+
* {@link OnrampSession.metadata}) and is not delivered on later widget
|
|
2019
|
+
* events, so use `appUserId` to correlate the user.
|
|
2004
2020
|
*
|
|
2005
2021
|
* Note: the embedding-domain allowlist entry (`referrerDomain`) is **not**
|
|
2006
2022
|
* part of this request. It is a server-only concern configured on
|
|
@@ -2030,8 +2046,11 @@ type OnrampSessionRequest = z.infer<typeof onrampSessionRequestSchema>;
|
|
|
2030
2046
|
* wallets-api. Pass to pre-select a chain in the widget.
|
|
2031
2047
|
* - `amount`, `currency`: optional pre-fills.
|
|
2032
2048
|
* - `email`: optional KYC routing hint.
|
|
2033
|
-
* - `metadata`:
|
|
2034
|
-
*
|
|
2049
|
+
* - `metadata`: optional string map. The Onramp API rejects more than 20
|
|
2050
|
+
* keys, keys over 64 characters, values over 1024 characters, and
|
|
2051
|
+
* control characters. It is echoed once on the create response (see
|
|
2052
|
+
* {@link OnrampSession.metadata}) and is not delivered on later widget
|
|
2053
|
+
* events, so use `appUserId` to correlate the user.
|
|
2035
2054
|
*/
|
|
2036
2055
|
type CreateSessionParams = OnrampSessionRequest;
|
|
2037
2056
|
/**
|
package/server.mjs
CHANGED
|
@@ -1212,6 +1212,8 @@ var SwapChain;
|
|
|
1212
1212
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
1213
1213
|
SwapChain["Monad"] = "Monad";
|
|
1214
1214
|
SwapChain["Arc"] = "Arc";
|
|
1215
|
+
SwapChain["Cronos"] = "Cronos";
|
|
1216
|
+
SwapChain["Morph"] = "Morph";
|
|
1215
1217
|
// Testnet chains with swap support
|
|
1216
1218
|
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
1217
1219
|
})(SwapChain || (SwapChain = {}));
|
|
@@ -2544,7 +2546,8 @@ var BorrowChain;
|
|
|
2544
2546
|
}
|
|
2545
2547
|
},
|
|
2546
2548
|
kitContracts: {
|
|
2547
|
-
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
2549
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
2550
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
2548
2551
|
}
|
|
2549
2552
|
});
|
|
2550
2553
|
|
|
@@ -3413,7 +3416,8 @@ var BorrowChain;
|
|
|
3413
3416
|
}
|
|
3414
3417
|
},
|
|
3415
3418
|
kitContracts: {
|
|
3416
|
-
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
3419
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3420
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
3417
3421
|
}
|
|
3418
3422
|
});
|
|
3419
3423
|
|
|
@@ -5459,8 +5463,8 @@ var BorrowChain;
|
|
|
5459
5463
|
* Zod schema for validating swap-specific chain identifiers.
|
|
5460
5464
|
*
|
|
5461
5465
|
* Validates chains based on:
|
|
5462
|
-
* -
|
|
5463
|
-
* - Mainnet
|
|
5466
|
+
* - Membership in the SwapChain enum
|
|
5467
|
+
* - Mainnet or explicitly allowlisted testnet
|
|
5464
5468
|
* - At least one supported token available
|
|
5465
5469
|
*
|
|
5466
5470
|
*/ z.union([
|
|
@@ -6197,11 +6201,13 @@ const swapTokenEnumSchema = z.enum([
|
|
|
6197
6201
|
[Blockchain.Arbitrum]: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
|
|
6198
6202
|
[Blockchain.Avalanche]: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
|
|
6199
6203
|
[Blockchain.Celo]: '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
|
|
6204
|
+
[Blockchain.Cronos]: '0x66e428c3f67a68878562e79A0234c1F83c208770',
|
|
6200
6205
|
[Blockchain.Ethereum]: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
6201
6206
|
[Blockchain.HyperEVM]: '0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb',
|
|
6202
6207
|
[Blockchain.Ink]: '0x0200C29006150606B650577BBE7B6248F58470c1',
|
|
6203
6208
|
[Blockchain.Linea]: '0xA219439258ca9da29E9Cc4cE5596924745e12B93',
|
|
6204
6209
|
[Blockchain.Monad]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
6210
|
+
[Blockchain.Morph]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
6205
6211
|
[Blockchain.NEAR]: 'usdt.tether-token.near',
|
|
6206
6212
|
[Blockchain.Optimism]: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
|
|
6207
6213
|
[Blockchain.Polkadot_Asset_Hub]: '1984',
|
|
@@ -6260,6 +6266,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
6260
6266
|
[Blockchain.Arbitrum]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
6261
6267
|
[Blockchain.Avalanche]: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
6262
6268
|
[Blockchain.Base]: '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb',
|
|
6269
|
+
[Blockchain.Cronos]: '0xF2001B145b43032AAF5Ee2884e456CCd805F677D',
|
|
6263
6270
|
[Blockchain.Ethereum]: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
6264
6271
|
[Blockchain.Linea]: '0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5',
|
|
6265
6272
|
[Blockchain.Optimism]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
@@ -6322,7 +6329,9 @@ const swapTokenEnumSchema = z.enum([
|
|
|
6322
6329
|
[Blockchain.Arbitrum]: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
6323
6330
|
[Blockchain.Avalanche]: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
|
|
6324
6331
|
[Blockchain.Base]: '0x4200000000000000000000000000000000000006',
|
|
6332
|
+
[Blockchain.Cronos]: '0xe44Fd7fCb2b1581822D0c862B68222998a0c299a',
|
|
6325
6333
|
[Blockchain.Ethereum]: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
6334
|
+
[Blockchain.Morph]: '0x5300000000000000000000000000000000000011',
|
|
6326
6335
|
[Blockchain.Optimism]: '0x4200000000000000000000000000000000000006',
|
|
6327
6336
|
[Blockchain.Polygon]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
6328
6337
|
[Blockchain.Solana]: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs'
|
|
@@ -6341,6 +6350,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
6341
6350
|
locators: {
|
|
6342
6351
|
[Blockchain.Ethereum]: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
6343
6352
|
[Blockchain.Arbitrum]: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f',
|
|
6353
|
+
[Blockchain.Cronos]: '0x062E66477Faf219F25D27dCED647BF57C3107d52',
|
|
6344
6354
|
[Blockchain.Avalanche]: '0x50b7545627a5162F82A992c33b87aDc75187B218'
|
|
6345
6355
|
}
|
|
6346
6356
|
};
|
|
@@ -8739,7 +8749,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8739
8749
|
return kit;
|
|
8740
8750
|
}
|
|
8741
8751
|
|
|
8742
|
-
var version = "1.0.
|
|
8752
|
+
var version = "1.0.4";
|
|
8743
8753
|
var pkg = {
|
|
8744
8754
|
version: version};
|
|
8745
8755
|
|
|
@@ -9375,7 +9385,7 @@ function isAbortLikeError(err) {
|
|
|
9375
9385
|
currency: z.string().min(1).optional(),
|
|
9376
9386
|
email: z.string().email().optional(),
|
|
9377
9387
|
assets: onrampAssetSelectionSchema.optional(),
|
|
9378
|
-
metadata: z.record(z.string(), z.
|
|
9388
|
+
metadata: z.record(z.string(), z.string()).optional()
|
|
9379
9389
|
});
|
|
9380
9390
|
|
|
9381
9391
|
/**
|
|
@@ -9537,7 +9547,7 @@ function isAbortLikeError(err) {
|
|
|
9537
9547
|
const widgetUrl = mergeAssetParams(existingWidgetUrl, composedWidgetUrl, assetParams);
|
|
9538
9548
|
const traceId = typeof session['traceId'] === 'string' ? session['traceId'] : ctx.invocation.traceId;
|
|
9539
9549
|
// Outbound allow-list. We deliberately rebuild the result from the
|
|
9540
|
-
// exact fields the client kit
|
|
9550
|
+
// exact fields the host and client kit consume rather than spreading
|
|
9541
9551
|
// `...session`. Inbound parsing stays schema-free for forward-compat
|
|
9542
9552
|
// (an additive upstream field must never break minting), but the
|
|
9543
9553
|
// server→browser hop is a trust boundary: any internal identifier,
|
|
@@ -9556,6 +9566,11 @@ function isAbortLikeError(err) {
|
|
|
9556
9566
|
if (typeof session['expiresAt'] === 'string') {
|
|
9557
9567
|
normalised['expiresAt'] = session['expiresAt'];
|
|
9558
9568
|
}
|
|
9569
|
+
// From the response only. No fallback to `params.metadata`.
|
|
9570
|
+
const metadata = readMetadataEcho(session['metadata']);
|
|
9571
|
+
if (metadata !== undefined) {
|
|
9572
|
+
normalised['metadata'] = metadata;
|
|
9573
|
+
}
|
|
9559
9574
|
if (widgetUrl === undefined) {
|
|
9560
9575
|
// `widgetUrl` is required on `MintedOnrampSession` (guaranteed
|
|
9561
9576
|
// present). If neither the API returned one nor a `sessionToken`
|
|
@@ -9592,6 +9607,17 @@ function isAbortLikeError(err) {
|
|
|
9592
9607
|
}
|
|
9593
9608
|
return url.toString();
|
|
9594
9609
|
}
|
|
9610
|
+
/**
|
|
9611
|
+
* Copy a plain-object, string-valued `metadata` echo, or drop it whole.
|
|
9612
|
+
*
|
|
9613
|
+
* @internal
|
|
9614
|
+
*/ function readMetadataEcho(value) {
|
|
9615
|
+
if (value === null || typeof value !== 'object' || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
9616
|
+
return undefined;
|
|
9617
|
+
}
|
|
9618
|
+
const entries = Object.entries(value);
|
|
9619
|
+
return entries.every(([, entry])=>typeof entry === 'string') ? Object.fromEntries(entries) : undefined;
|
|
9620
|
+
}
|
|
9595
9621
|
/**
|
|
9596
9622
|
* Translate the SDK parameter shape into the wallets-api request body.
|
|
9597
9623
|
*
|