Skip to content

Commit be34cb9

Browse files
committed
Add Rampnow as a fiat onramp provider
Add support for the new "rampnow" onramp provider across the codebase. Updates include: adding "rampnow" to Onramp types and API request body, adding it to the FiatProviders list and provider->onramp mapping, including it in the useBuyWithFiatQuotesForProviders hook, and adding the provider entry (icon/description) plus selection typing/handlers in the Bridge UI and payment types.
1 parent eb07340 commit be34cb9

7 files changed

Lines changed: 21 additions & 11 deletions

File tree

packages/thirdweb/src/bridge/Onramp.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { TokenWithPrices } from "./types/Token.js";
1313
export { status } from "./OnrampStatus.js";
1414

1515
type OnrampIntent = {
16-
onramp: "stripe" | "coinbase" | "transak";
16+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
1717
chainId: number;
1818
tokenAddress: ox__Address.Address;
1919
receiver: ox__Address.Address;
@@ -42,7 +42,7 @@ type OnrampPrepareQuoteResponseData = {
4242

4343
// Explicit type for the API request body
4444
interface OnrampApiRequestBody {
45-
onramp: "stripe" | "coinbase" | "transak";
45+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
4646
chainId: number;
4747
tokenAddress: ox__Address.Address;
4848
receiver: ox__Address.Address;
@@ -272,8 +272,8 @@ export declare namespace prepare {
272272
export type Options = {
273273
/** Your thirdweb client */
274274
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";
277277
/** The destination chain ID */
278278
chainId: number;
279279
/** The destination token address */

packages/thirdweb/src/pay/buyWithFiat/getQuote.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,14 @@ export async function getBuyWithFiatQuote(
290290
// map preferred provider (FiatProvider) → onramp string expected by Onramp.prepare
291291
const mapProviderToOnramp = (
292292
provider?: FiatProvider,
293-
): "stripe" | "coinbase" | "transak" => {
293+
): "stripe" | "coinbase" | "transak" | "rampnow" => {
294294
switch (provider) {
295295
case "stripe":
296296
return "stripe";
297297
case "transak":
298298
return "transak";
299+
case "rampnow":
300+
return "rampnow";
299301
default: // default to coinbase when undefined or any other value
300302
return "coinbase";
301303
}

packages/thirdweb/src/pay/utils/commonTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ export type PayOnChainTransactionDetails = {
1919

2020
export type FiatProvider = (typeof FiatProviders)[number];
2121

22-
const FiatProviders = ["coinbase", "stripe", "transak"] as const;
22+
const FiatProviders = ["coinbase", "stripe", "transak", "rampnow"] as const;

packages/thirdweb/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ type UseBuyWithFiatQuotesForProvidersResult = {
6060

6161
/**
6262
* @internal
63-
* Hook to get prepared onramp quotes from Coinbase, Stripe, and Transak providers.
63+
* Hook to get prepared onramp quotes from Coinbase, Stripe, Transak, and Rampnow providers.
6464
*/
6565
export function useBuyWithFiatQuotesForProviders(
6666
params?: UseBuyWithFiatQuotesForProvidersParams,
6767
queryOptions?: OnrampQuoteQueryOptions,
6868
): UseBuyWithFiatQuotesForProvidersResult {
69-
const providers = ["coinbase", "stripe", "transak"] as const;
69+
const providers = ["coinbase", "stripe", "transak", "rampnow"] as const;
7070

7171
const queries = useQueries({
7272
queries: providers.map((provider) => ({

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import { Text } from "../../components/text.js";
2121

2222
interface FiatProviderSelectionProps {
2323
client: ThirdwebClient;
24-
onProviderSelected: (provider: "coinbase" | "stripe" | "transak") => void;
24+
onProviderSelected: (
25+
provider: "coinbase" | "stripe" | "transak" | "rampnow",
26+
) => void;
2527
toChainId: number;
2628
toTokenAddress: string;
2729
toAddress: string;
@@ -49,6 +51,12 @@ const PROVIDERS = [
4951
id: "transak" as const,
5052
name: "Transak",
5153
},
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+
},
5260
];
5361

5462
export function FiatProviderSelection({

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export function PaymentSelection({
184184
};
185185

186186
const handleOnrampProviderSelected = (
187-
provider: "coinbase" | "stripe" | "transak",
187+
provider: "coinbase" | "stripe" | "transak" | "rampnow",
188188
) => {
189189
const recipientAddress =
190190
receiverAddress || payerWallet?.getAccount()?.address;

packages/thirdweb/src/react/web/ui/Bridge/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ export type PaymentMethod =
4444
type: "fiat";
4545
payerWallet?: Wallet;
4646
currency: SupportedFiatCurrency;
47-
onramp: "stripe" | "coinbase" | "transak";
47+
onramp: "stripe" | "coinbase" | "transak" | "rampnow";
4848
};

0 commit comments

Comments
 (0)