thirdweb 5.119.3 → 5.120.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/dist/cjs/bridge/Onramp.js +1 -1
- package/dist/cjs/extensions/ens/__generated__/UniversalResolver/read/reverse.js +10 -6
- package/dist/cjs/extensions/ens/__generated__/UniversalResolver/read/reverse.js.map +1 -1
- package/dist/cjs/extensions/ens/constants.js +1 -1
- package/dist/cjs/extensions/ens/resolve-name.js +15 -12
- package/dist/cjs/extensions/ens/resolve-name.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js +3 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/pay/utils/commonTypes.js +1 -1
- package/dist/cjs/pay/utils/commonTypes.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js +2 -2
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js +6 -0
- package/dist/cjs/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/bridge/Onramp.js +1 -1
- package/dist/esm/extensions/ens/__generated__/UniversalResolver/read/reverse.js +10 -6
- package/dist/esm/extensions/ens/__generated__/UniversalResolver/read/reverse.js.map +1 -1
- package/dist/esm/extensions/ens/constants.js +1 -1
- package/dist/esm/extensions/ens/resolve-name.js +15 -12
- package/dist/esm/extensions/ens/resolve-name.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js +3 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/pay/utils/commonTypes.js +1 -1
- package/dist/esm/pay/utils/commonTypes.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js +2 -2
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js +6 -0
- package/dist/esm/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/scripts/bridge-widget.d.ts +4 -4
- package/dist/scripts/bridge-widget.js +81 -81
- package/dist/types/bridge/Onramp.d.ts +4 -4
- package/dist/types/bridge/Onramp.d.ts.map +1 -1
- package/dist/types/extensions/ens/__generated__/UniversalResolver/read/reverse.d.ts +7 -3
- package/dist/types/extensions/ens/__generated__/UniversalResolver/read/reverse.d.ts.map +1 -1
- package/dist/types/extensions/ens/constants.d.ts +1 -1
- package/dist/types/extensions/ens/resolve-name.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.d.ts +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/FiatProviderSelection.d.ts +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/FiatProviderSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/types.d.ts +1 -1
- package/dist/types/react/web/ui/Bridge/types.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/bridge/Onramp.test.ts +29 -0
- package/src/bridge/Onramp.ts +5 -5
- package/src/extensions/ens/__generated__/UniversalResolver/read/reverse.ts +14 -6
- package/src/extensions/ens/constants.ts +1 -1
- package/src/extensions/ens/resolve-name.ts +20 -17
- package/src/pay/buyWithFiat/getQuote.ts +4 -2
- package/src/pay/utils/commonTypes.ts +1 -1
- package/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.test.tsx +109 -0
- package/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts +2 -2
- package/src/react/core/hooks/useBridgePrepare.test.ts +17 -0
- package/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx +9 -1
- package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +1 -1
- package/src/react/web/ui/Bridge/types.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -5,7 +5,7 @@ import type { RouteStep } from "./types/Route.js";
|
|
|
5
5
|
import type { TokenWithPrices } from "./types/Token.js";
|
|
6
6
|
export { status } from "./OnrampStatus.js";
|
|
7
7
|
type OnrampIntent = {
|
|
8
|
-
onramp: "stripe" | "coinbase" | "transak";
|
|
8
|
+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
|
|
9
9
|
chainId: number;
|
|
10
10
|
tokenAddress: ox__Address.Address;
|
|
11
11
|
receiver: ox__Address.Address;
|
|
@@ -100,7 +100,7 @@ type OnrampPrepareQuoteResponseData = {
|
|
|
100
100
|
*
|
|
101
101
|
* @param options - The options for preparing the onramp.
|
|
102
102
|
* @param options.client - Your thirdweb client.
|
|
103
|
-
* @param options.onramp - The onramp provider to use (e.g., "stripe", "coinbase", "transak").
|
|
103
|
+
* @param options.onramp - The onramp provider to use (e.g., "stripe", "coinbase", "transak", "rampnow").
|
|
104
104
|
* @param options.chainId - The destination chain ID.
|
|
105
105
|
* @param options.tokenAddress - The destination token address.
|
|
106
106
|
* @param options.receiver - The address that will receive the output token.
|
|
@@ -134,8 +134,8 @@ export declare namespace prepare {
|
|
|
134
134
|
type Options = {
|
|
135
135
|
/** Your thirdweb client */
|
|
136
136
|
client: ThirdwebClient;
|
|
137
|
-
/** The onramp provider to use (e.g., "stripe", "coinbase", "transak") */
|
|
138
|
-
onramp: "stripe" | "coinbase" | "transak";
|
|
137
|
+
/** The onramp provider to use (e.g., "stripe", "coinbase", "transak", "rampnow") */
|
|
138
|
+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
|
|
139
139
|
/** The destination chain ID */
|
|
140
140
|
chainId: number;
|
|
141
141
|
/** The destination token address */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Onramp.d.ts","sourceRoot":"","sources":["../../../src/bridge/Onramp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Onramp.d.ts","sourceRoot":"","sources":["../../../src/bridge/Onramp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC;IAClC,QAAQ,EAAE,WAAW,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oCAAoC;QACpC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC;QAClC,qDAAqD;QACrD,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC;QAC9B,sCAAsC;QACtC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,8BAA8B;QAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;QAC5B,4DAA4D;QAC5D,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7B,iGAAiG;QACjG,kBAAkB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;QACzC,oFAAoF;QACpF,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,8FAA8F;QAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,0CAA0C;QAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,uEAAuE;QACvE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACpC,oIAAoI;QACpI,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IAEF;;;;;OAKG;IACH,KAAY,MAAM,GAAG,8BAA8B,CAAC;CACrD"}
|
|
@@ -9,8 +9,12 @@ export type ReverseParams = {
|
|
|
9
9
|
type: "bytes";
|
|
10
10
|
name: "reverseName";
|
|
11
11
|
}>;
|
|
12
|
+
coinType: AbiParameterToPrimitiveType<{
|
|
13
|
+
type: "uint256";
|
|
14
|
+
name: "coinType";
|
|
15
|
+
}>;
|
|
12
16
|
};
|
|
13
|
-
export declare const FN_SELECTOR: "
|
|
17
|
+
export declare const FN_SELECTOR: "0x5d78a217";
|
|
14
18
|
/**
|
|
15
19
|
* Checks if the `reverse` method is supported by the given contract.
|
|
16
20
|
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
|
@@ -62,7 +66,7 @@ export declare function encodeReverse(options: ReverseParams): `${typeof FN_SELE
|
|
|
62
66
|
* const result = decodeReverseResultResult("...");
|
|
63
67
|
* ```
|
|
64
68
|
*/
|
|
65
|
-
export declare function decodeReverseResult(result: Hex): readonly [string, `0x${string}`, `0x${string}
|
|
69
|
+
export declare function decodeReverseResult(result: Hex): readonly [string, `0x${string}`, `0x${string}`];
|
|
66
70
|
/**
|
|
67
71
|
* Calls the "reverse" function on the contract.
|
|
68
72
|
* @param options - The options for the reverse function.
|
|
@@ -79,5 +83,5 @@ export declare function decodeReverseResult(result: Hex): readonly [string, `0x$
|
|
|
79
83
|
*
|
|
80
84
|
* ```
|
|
81
85
|
*/
|
|
82
|
-
export declare function reverse(options: BaseTransactionOptions<ReverseParams>): Promise<readonly [string, string, string
|
|
86
|
+
export declare function reverse(options: BaseTransactionOptions<ReverseParams>): Promise<readonly [string, string, string]>;
|
|
83
87
|
//# sourceMappingURL=reverse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/ens/__generated__/UniversalResolver/read/reverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,2BAA2B,CAAC;QACvC,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,aAAa,CAAC;KACrB,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/ens/__generated__/UniversalResolver/read/reverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,2BAA2B,CAAC;QACvC,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,aAAa,CAAC;KACrB,CAAC,CAAC;IACH,QAAQ,EAAE,2BAA2B,CAAC;QACpC,IAAI,EAAE,SAAS,CAAC;QAChB,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;AAuBjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAK9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,iBAKzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAIN,GAAG,OAAO,WAAW,GAAG,MAAM,EAAE,CAC7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,mDAE9C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,8CAM3E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const UNIVERSAL_RESOLVER_ADDRESS = "
|
|
1
|
+
export declare const UNIVERSAL_RESOLVER_ADDRESS = "0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
|
|
2
2
|
export declare const BASENAME_RESOLVER_ADDRESS = "0xC6d566A56A1aFf6508b41f6c90ff131615583BCD";
|
|
3
3
|
export declare const BASE_SEPOLIA_BASENAME_RESOLVER_ADDRESS = "0x6533C94869D28fAA8dF77cc63f9e2b2D6Cf77eBA";
|
|
4
4
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-name.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ens/resolve-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-name.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ens/resolve-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwCxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../../src/pay/buyWithFiat/getQuote.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iEAAiE,CAAC;AAEpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EA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C;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;IAEF;;;;;;;;;OASG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAiM3B"}
|
|
@@ -16,6 +16,6 @@ export type PayOnChainTransactionDetails = {
|
|
|
16
16
|
explorerLink?: string;
|
|
17
17
|
};
|
|
18
18
|
export type FiatProvider = (typeof FiatProviders)[number];
|
|
19
|
-
declare const FiatProviders: readonly ["coinbase", "stripe", "transak"];
|
|
19
|
+
declare const FiatProviders: readonly ["coinbase", "stripe", "transak", "rampnow"];
|
|
20
20
|
export {};
|
|
21
21
|
//# sourceMappingURL=commonTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonTypes.d.ts","sourceRoot":"","sources":["../../../../src/pay/utils/commonTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"commonTypes.d.ts","sourceRoot":"","sources":["../../../../src/pay/utils/commonTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,QAAA,MAAM,aAAa,uDAAwD,CAAC"}
|
|
@@ -51,7 +51,7 @@ type UseBuyWithFiatQuotesForProvidersResult = {
|
|
|
51
51
|
}[];
|
|
52
52
|
/**
|
|
53
53
|
* @internal
|
|
54
|
-
* Hook to get prepared onramp quotes from Coinbase, Stripe, and
|
|
54
|
+
* Hook to get prepared onramp quotes from Coinbase, Stripe, Transak, and Rampnow providers.
|
|
55
55
|
*/
|
|
56
56
|
export declare function useBuyWithFiatQuotesForProviders(params?: UseBuyWithFiatQuotesForProvidersParams, queryOptions?: OnrampQuoteQueryOptions): UseBuyWithFiatQuotesForProvidersResult;
|
|
57
57
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
|
2
2
|
import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
|
|
3
3
|
interface FiatProviderSelectionProps {
|
|
4
4
|
client: ThirdwebClient;
|
|
5
|
-
onProviderSelected: (provider: "coinbase" | "stripe" | "transak") => void;
|
|
5
|
+
onProviderSelected: (provider: "coinbase" | "stripe" | "transak" | "rampnow") => void;
|
|
6
6
|
toChainId: number;
|
|
7
7
|
toTokenAddress: string;
|
|
8
8
|
toAddress: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FiatProviderSelection.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAkBhF,UAAU,0BAA0B;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"FiatProviderSelection.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAkBhF,UAAU,0BAA0B;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,kBAAkB,EAAE,CAClB,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,KACpD,IAAI,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,MAA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C,GAAG,CAAC,CAAC,CAAC,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,eAAe,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;CAC3B,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;CACvD,CAAC"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.120.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -115,4 +115,33 @@ describe.runIf(process.env.TW_SECRET_KEY)("Bridge.Onramp.prepare", () => {
|
|
|
115
115
|
// Steps array should be defined (it may be empty if the provider supports the destination token natively)
|
|
116
116
|
expect(Array.isArray(prepared.steps)).toBe(true);
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
// The Rampnow live-API test is gated on a separate env var because the
|
|
120
|
+
// server-side schema for `onramp: "rampnow"` lands in a separate deploy.
|
|
121
|
+
// Once `api.thirdweb-dev.com` accepts the new provider, drop the runIf and
|
|
122
|
+
// mirror the stripe/coinbase/transak assertions above.
|
|
123
|
+
it.runIf(process.env.TW_BRIDGE_RAMPNOW)(
|
|
124
|
+
"should prepare a Rampnow onramp successfully",
|
|
125
|
+
async () => {
|
|
126
|
+
const prepared = await Onramp.prepare({
|
|
127
|
+
amount: toWei("0.01"),
|
|
128
|
+
chainId: 1,
|
|
129
|
+
client: TEST_CLIENT,
|
|
130
|
+
onramp: "rampnow",
|
|
131
|
+
receiver: RECEIVER_ADDRESS,
|
|
132
|
+
tokenAddress: NATIVE_TOKEN_ADDRESS,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
expect(prepared).toBeDefined();
|
|
136
|
+
expect(typeof prepared.destinationAmount).toBe("bigint");
|
|
137
|
+
expect(prepared.destinationAmount > 0n).toBe(true);
|
|
138
|
+
expect(prepared.link).toBeDefined();
|
|
139
|
+
expect(typeof prepared.link).toBe("string");
|
|
140
|
+
expect(prepared.intent).toBeDefined();
|
|
141
|
+
expect(prepared.intent.receiver.toLowerCase()).toBe(
|
|
142
|
+
RECEIVER_ADDRESS.toLowerCase(),
|
|
143
|
+
);
|
|
144
|
+
expect(Array.isArray(prepared.steps)).toBe(true);
|
|
145
|
+
},
|
|
146
|
+
);
|
|
118
147
|
});
|
package/src/bridge/Onramp.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { TokenWithPrices } from "./types/Token.js";
|
|
|
13
13
|
export { status } from "./OnrampStatus.js";
|
|
14
14
|
|
|
15
15
|
type OnrampIntent = {
|
|
16
|
-
onramp: "stripe" | "coinbase" | "transak";
|
|
16
|
+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
|
|
17
17
|
chainId: number;
|
|
18
18
|
tokenAddress: ox__Address.Address;
|
|
19
19
|
receiver: ox__Address.Address;
|
|
@@ -42,7 +42,7 @@ type OnrampPrepareQuoteResponseData = {
|
|
|
42
42
|
|
|
43
43
|
// Explicit type for the API request body
|
|
44
44
|
interface OnrampApiRequestBody {
|
|
45
|
-
onramp: "stripe" | "coinbase" | "transak";
|
|
45
|
+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
|
|
46
46
|
chainId: number;
|
|
47
47
|
tokenAddress: ox__Address.Address;
|
|
48
48
|
receiver: ox__Address.Address;
|
|
@@ -128,7 +128,7 @@ interface OnrampApiRequestBody {
|
|
|
128
128
|
*
|
|
129
129
|
* @param options - The options for preparing the onramp.
|
|
130
130
|
* @param options.client - Your thirdweb client.
|
|
131
|
-
* @param options.onramp - The onramp provider to use (e.g., "stripe", "coinbase", "transak").
|
|
131
|
+
* @param options.onramp - The onramp provider to use (e.g., "stripe", "coinbase", "transak", "rampnow").
|
|
132
132
|
* @param options.chainId - The destination chain ID.
|
|
133
133
|
* @param options.tokenAddress - The destination token address.
|
|
134
134
|
* @param options.receiver - The address that will receive the output token.
|
|
@@ -272,8 +272,8 @@ export declare namespace prepare {
|
|
|
272
272
|
export type Options = {
|
|
273
273
|
/** Your thirdweb client */
|
|
274
274
|
client: ThirdwebClient;
|
|
275
|
-
/** The onramp provider to use (e.g., "stripe", "coinbase", "transak") */
|
|
276
|
-
onramp: "stripe" | "coinbase" | "transak";
|
|
275
|
+
/** The onramp provider to use (e.g., "stripe", "coinbase", "transak", "rampnow") */
|
|
276
|
+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
|
|
277
277
|
/** The destination chain ID */
|
|
278
278
|
chainId: number;
|
|
279
279
|
/** The destination token address */
|
|
@@ -14,14 +14,22 @@ export type ReverseParams = {
|
|
|
14
14
|
type: "bytes";
|
|
15
15
|
name: "reverseName";
|
|
16
16
|
}>;
|
|
17
|
+
coinType: AbiParameterToPrimitiveType<{
|
|
18
|
+
type: "uint256";
|
|
19
|
+
name: "coinType";
|
|
20
|
+
}>;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
export const FN_SELECTOR = "
|
|
23
|
+
export const FN_SELECTOR = "0x5d78a217" as const;
|
|
20
24
|
const FN_INPUTS = [
|
|
21
25
|
{
|
|
22
26
|
name: "reverseName",
|
|
23
27
|
type: "bytes",
|
|
24
28
|
},
|
|
29
|
+
{
|
|
30
|
+
name: "coinType",
|
|
31
|
+
type: "uint256",
|
|
32
|
+
},
|
|
25
33
|
] as const;
|
|
26
34
|
const FN_OUTPUTS = [
|
|
27
35
|
{
|
|
@@ -33,9 +41,6 @@ const FN_OUTPUTS = [
|
|
|
33
41
|
{
|
|
34
42
|
type: "address",
|
|
35
43
|
},
|
|
36
|
-
{
|
|
37
|
-
type: "address",
|
|
38
|
-
},
|
|
39
44
|
] as const;
|
|
40
45
|
|
|
41
46
|
/**
|
|
@@ -70,7 +75,10 @@ export function isReverseSupported(availableSelectors: string[]) {
|
|
|
70
75
|
* ```
|
|
71
76
|
*/
|
|
72
77
|
export function encodeReverseParams(options: ReverseParams) {
|
|
73
|
-
return encodeAbiParameters(FN_INPUTS, [
|
|
78
|
+
return encodeAbiParameters(FN_INPUTS, [
|
|
79
|
+
options.reverseName,
|
|
80
|
+
options.coinType,
|
|
81
|
+
]);
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
/**
|
|
@@ -128,6 +136,6 @@ export async function reverse(options: BaseTransactionOptions<ReverseParams>) {
|
|
|
128
136
|
return readContract({
|
|
129
137
|
contract: options.contract,
|
|
130
138
|
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
|
131
|
-
params: [options.reverseName],
|
|
139
|
+
params: [options.reverseName, options.coinType],
|
|
132
140
|
});
|
|
133
141
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const UNIVERSAL_RESOLVER_ADDRESS =
|
|
2
|
-
"
|
|
2
|
+
"0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
|
|
3
3
|
export const BASENAME_RESOLVER_ADDRESS =
|
|
4
4
|
"0xC6d566A56A1aFf6508b41f6c90ff131615583BCD";
|
|
5
5
|
export const BASE_SEPOLIA_BASENAME_RESOLVER_ADDRESS =
|
|
@@ -3,8 +3,6 @@ import { ethereum } from "../../chains/chain-definitions/ethereum.js";
|
|
|
3
3
|
import type { Chain } from "../../chains/types.js";
|
|
4
4
|
import type { ThirdwebClient } from "../../client/client.js";
|
|
5
5
|
import { getContract } from "../../contract/contract.js";
|
|
6
|
-
import { toHex } from "../../utils/encoding/hex.js";
|
|
7
|
-
import { packetToBytes } from "../../utils/ens/packetToBytes.js";
|
|
8
6
|
import { withCache } from "../../utils/promise/withCache.js";
|
|
9
7
|
import { reverse } from "./__generated__/UniversalResolver/read/reverse.js";
|
|
10
8
|
import { UNIVERSAL_RESOLVER_ADDRESS } from "./constants.js";
|
|
@@ -33,7 +31,9 @@ export type ResolveNameOptions = {
|
|
|
33
31
|
* @extension ENS
|
|
34
32
|
* @returns A promise that resolves to the Ethereum address.
|
|
35
33
|
*/
|
|
36
|
-
export async function resolveName(
|
|
34
|
+
export async function resolveName(
|
|
35
|
+
options: ResolveNameOptions,
|
|
36
|
+
): Promise<string | null> {
|
|
37
37
|
const { client, address, resolverAddress, resolverChain } = options;
|
|
38
38
|
|
|
39
39
|
return withCache(
|
|
@@ -44,25 +44,28 @@ export async function resolveName(options: ResolveNameOptions) {
|
|
|
44
44
|
client,
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
const
|
|
48
|
-
packetToBytes(`${address.toLowerCase().substring(2)}.addr.reverse`),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const [name, resolvedAddress] = await reverse({
|
|
47
|
+
const [name] = await reverse({
|
|
52
48
|
contract,
|
|
53
|
-
reverseName
|
|
49
|
+
reverseName: address as `0x${string}`,
|
|
50
|
+
coinType: 60n,
|
|
54
51
|
}).catch((e) => {
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
// Re-throw verification errors so callers can detect data integrity issues
|
|
53
|
+
if (
|
|
54
|
+
typeof e === "object" &&
|
|
55
|
+
e !== null &&
|
|
56
|
+
"data" in e &&
|
|
57
|
+
typeof e.data === "string"
|
|
58
|
+
) {
|
|
59
|
+
// ReverseAddressMismatch(string,bytes) = 0xef9c03ce
|
|
60
|
+
if (e.data.startsWith("0xef9c03ce")) {
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
|
-
|
|
64
|
+
// Swallow expected "no resolver" / "no name" errors
|
|
65
|
+
return [null] as const;
|
|
59
66
|
});
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return name;
|
|
68
|
+
return name || null;
|
|
66
69
|
},
|
|
67
70
|
{
|
|
68
71
|
cacheKey: `ens:name:${resolverChain?.id || 1}:${address}`,
|
|
@@ -290,12 +290,14 @@ export async function getBuyWithFiatQuote(
|
|
|
290
290
|
// map preferred provider (FiatProvider) → onramp string expected by Onramp.prepare
|
|
291
291
|
const mapProviderToOnramp = (
|
|
292
292
|
provider?: FiatProvider,
|
|
293
|
-
): "stripe" | "coinbase" | "transak" => {
|
|
293
|
+
): "stripe" | "coinbase" | "transak" | "rampnow" => {
|
|
294
294
|
switch (provider) {
|
|
295
295
|
case "stripe":
|
|
296
296
|
return "stripe";
|
|
297
297
|
case "transak":
|
|
298
298
|
return "transak";
|
|
299
|
+
case "rampnow":
|
|
300
|
+
return "rampnow";
|
|
299
301
|
default: // default to coinbase when undefined or any other value
|
|
300
302
|
return "coinbase";
|
|
301
303
|
}
|
|
@@ -463,7 +465,7 @@ export async function getBuyWithFiatQuote(
|
|
|
463
465
|
onRampLink: prepared.link,
|
|
464
466
|
onRampToken: onRampTokenObject,
|
|
465
467
|
processingFees: [],
|
|
466
|
-
provider:
|
|
468
|
+
provider: params.preferredProvider ?? "coinbase",
|
|
467
469
|
routingToken: routingTokenObject,
|
|
468
470
|
toAddress: params.toAddress,
|
|
469
471
|
toAmountMin: toAmountMin,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
2
|
+
import { renderHook, waitFor } from "@testing-library/react";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
|
6
|
+
import { prepare as prepareOnramp } from "../../../../bridge/Onramp.js";
|
|
7
|
+
import { getToken } from "../../../../pay/convert/get-token.js";
|
|
8
|
+
import { useBuyWithFiatQuotesForProviders } from "./useBuyWithFiatQuotesForProviders.js";
|
|
9
|
+
|
|
10
|
+
vi.mock("../../../../bridge/Onramp.js");
|
|
11
|
+
vi.mock("../../../../pay/convert/get-token.js");
|
|
12
|
+
|
|
13
|
+
const RECEIVER = "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709" as const;
|
|
14
|
+
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" as const;
|
|
15
|
+
|
|
16
|
+
describe("useBuyWithFiatQuotesForProviders", () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
vi.clearAllMocks();
|
|
19
|
+
vi.mocked(getToken).mockResolvedValue({
|
|
20
|
+
address: USDC,
|
|
21
|
+
chainId: 1,
|
|
22
|
+
decimals: 6,
|
|
23
|
+
name: "USD Coin",
|
|
24
|
+
priceUsd: 1,
|
|
25
|
+
prices: { USD: 1 },
|
|
26
|
+
symbol: "USDC",
|
|
27
|
+
});
|
|
28
|
+
// Return a minimal valid prepared-onramp response per call.
|
|
29
|
+
vi.mocked(prepareOnramp).mockImplementation(async (opts) => ({
|
|
30
|
+
currency: opts.currency ?? "USD",
|
|
31
|
+
currencyAmount: 1,
|
|
32
|
+
destinationAmount: opts.amount ?? 1n,
|
|
33
|
+
destinationToken: {
|
|
34
|
+
address: opts.tokenAddress,
|
|
35
|
+
chainId: opts.chainId,
|
|
36
|
+
decimals: 6,
|
|
37
|
+
name: "USD Coin",
|
|
38
|
+
priceUsd: 1,
|
|
39
|
+
prices: { USD: 1 },
|
|
40
|
+
symbol: "USDC",
|
|
41
|
+
},
|
|
42
|
+
id: `mock-${opts.onramp}`,
|
|
43
|
+
intent: {
|
|
44
|
+
amount: (opts.amount ?? 1n).toString(),
|
|
45
|
+
chainId: opts.chainId,
|
|
46
|
+
onramp: opts.onramp,
|
|
47
|
+
receiver: opts.receiver,
|
|
48
|
+
tokenAddress: opts.tokenAddress,
|
|
49
|
+
},
|
|
50
|
+
link: `https://example.com/${opts.onramp}`,
|
|
51
|
+
steps: [],
|
|
52
|
+
timestamp: 0,
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const wrapper = ({ children }: { children: React.ReactNode }) => {
|
|
57
|
+
const queryClient = new QueryClient({
|
|
58
|
+
defaultOptions: { queries: { retry: false } },
|
|
59
|
+
});
|
|
60
|
+
return (
|
|
61
|
+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
it("fans out to all four onramp providers (including rampnow)", async () => {
|
|
66
|
+
const { result } = renderHook(
|
|
67
|
+
() =>
|
|
68
|
+
useBuyWithFiatQuotesForProviders({
|
|
69
|
+
amount: "10",
|
|
70
|
+
chainId: 1,
|
|
71
|
+
client: TEST_CLIENT,
|
|
72
|
+
country: "US",
|
|
73
|
+
currency: "USD",
|
|
74
|
+
receiver: RECEIVER,
|
|
75
|
+
tokenAddress: USDC,
|
|
76
|
+
}),
|
|
77
|
+
{ wrapper },
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
await waitFor(() => {
|
|
81
|
+
expect(result.current.every((q) => q.isSuccess)).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(result.current).toHaveLength(4);
|
|
85
|
+
|
|
86
|
+
// Each provider should be called exactly once with the expected `onramp` value.
|
|
87
|
+
const calls = vi.mocked(prepareOnramp).mock.calls.map((c) => c[0].onramp);
|
|
88
|
+
expect(calls.sort()).toEqual(
|
|
89
|
+
["coinbase", "rampnow", "stripe", "transak"].sort(),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// The hook should surface the prepared link per provider.
|
|
93
|
+
const links = result.current.map((q) => q.data?.link);
|
|
94
|
+
expect(links).toContain("https://example.com/rampnow");
|
|
95
|
+
expect(links).toContain("https://example.com/stripe");
|
|
96
|
+
expect(links).toContain("https://example.com/coinbase");
|
|
97
|
+
expect(links).toContain("https://example.com/transak");
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("is disabled when no params are provided", () => {
|
|
101
|
+
const { result } = renderHook(() => useBuyWithFiatQuotesForProviders(), {
|
|
102
|
+
wrapper,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
expect(result.current).toHaveLength(4);
|
|
106
|
+
expect(result.current.every((q) => !q.isSuccess && !q.isError)).toBe(true);
|
|
107
|
+
expect(vi.mocked(prepareOnramp)).not.toHaveBeenCalled();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -60,13 +60,13 @@ type UseBuyWithFiatQuotesForProvidersResult = {
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* @internal
|
|
63
|
-
* Hook to get prepared onramp quotes from Coinbase, Stripe, and
|
|
63
|
+
* Hook to get prepared onramp quotes from Coinbase, Stripe, Transak, and Rampnow providers.
|
|
64
64
|
*/
|
|
65
65
|
export function useBuyWithFiatQuotesForProviders(
|
|
66
66
|
params?: UseBuyWithFiatQuotesForProvidersParams,
|
|
67
67
|
queryOptions?: OnrampQuoteQueryOptions,
|
|
68
68
|
): UseBuyWithFiatQuotesForProvidersResult {
|
|
69
|
-
const providers = ["coinbase", "stripe", "transak"] as const;
|
|
69
|
+
const providers = ["coinbase", "stripe", "transak", "rampnow"] as const;
|
|
70
70
|
|
|
71
71
|
const queries = useQueries({
|
|
72
72
|
queries: providers.map((provider) => ({
|
|
@@ -81,6 +81,23 @@ describe("useBridgePrepare", () => {
|
|
|
81
81
|
expect(onrampRequest.client).toBe(mockClient);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
it("should accept all supported onramp providers including rampnow", () => {
|
|
85
|
+
const providers = ["stripe", "coinbase", "transak", "rampnow"] as const;
|
|
86
|
+
for (const onramp of providers) {
|
|
87
|
+
const onrampRequest: BridgePrepareRequest = {
|
|
88
|
+
amount: 1000000n,
|
|
89
|
+
chainId: 1,
|
|
90
|
+
client: mockClient,
|
|
91
|
+
onramp,
|
|
92
|
+
receiver: "0x1234567890123456789012345678901234567890",
|
|
93
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
94
|
+
type: "onramp",
|
|
95
|
+
};
|
|
96
|
+
expect(onrampRequest.type).toBe("onramp");
|
|
97
|
+
expect(onrampRequest.onramp).toBe(onramp);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
84
101
|
it("should handle UseBridgePrepareParams with enabled option", () => {
|
|
85
102
|
const params: UseBridgePrepareParams = {
|
|
86
103
|
amount: 1000000n,
|
|
@@ -21,7 +21,9 @@ import { Text } from "../../components/text.js";
|
|
|
21
21
|
|
|
22
22
|
interface FiatProviderSelectionProps {
|
|
23
23
|
client: ThirdwebClient;
|
|
24
|
-
onProviderSelected: (
|
|
24
|
+
onProviderSelected: (
|
|
25
|
+
provider: "coinbase" | "stripe" | "transak" | "rampnow",
|
|
26
|
+
) => void;
|
|
25
27
|
toChainId: number;
|
|
26
28
|
toTokenAddress: string;
|
|
27
29
|
toAddress: string;
|
|
@@ -49,6 +51,12 @@ const PROVIDERS = [
|
|
|
49
51
|
id: "transak" as const,
|
|
50
52
|
name: "Transak",
|
|
51
53
|
},
|
|
54
|
+
{
|
|
55
|
+
description: "Cards, bank transfers and more",
|
|
56
|
+
iconUri: "https://app.rampnow.io/favicon.ico",
|
|
57
|
+
id: "rampnow" as const,
|
|
58
|
+
name: "Rampnow",
|
|
59
|
+
},
|
|
52
60
|
];
|
|
53
61
|
|
|
54
62
|
export function FiatProviderSelection({
|
|
@@ -184,7 +184,7 @@ export function PaymentSelection({
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
const handleOnrampProviderSelected = (
|
|
187
|
-
provider: "coinbase" | "stripe" | "transak",
|
|
187
|
+
provider: "coinbase" | "stripe" | "transak" | "rampnow",
|
|
188
188
|
) => {
|
|
189
189
|
const recipientAddress =
|
|
190
190
|
receiverAddress || payerWallet?.getAccount()?.address;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.
|
|
1
|
+
export const version = "5.120.0";
|