Skip to content

Commit 2932094

Browse files
authored
fix: update coinbase query (#143)
1 parent b6a49bc commit 2932094

File tree

2 files changed

+64
-146
lines changed

2 files changed

+64
-146
lines changed

src/utils/api/cartridge/generated.ts

Lines changed: 39 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,14 @@ export type CoinbaseOnrampOrder = {
760760
updatedAt: Scalars['Time'];
761761
};
762762

763+
export type CoinbaseOnrampOrderResponse = {
764+
__typename?: 'CoinbaseOnrampOrderResponse';
765+
/** The Coinbase onramp order details. */
766+
coinbaseOrder: CoinbaseOnrampOrder;
767+
/** The Layerswap payment details for tracking the bridge. */
768+
layerswapPayment: LayerswapPayment;
769+
};
770+
763771
export type CoinbaseOnrampQuote = {
764772
__typename?: 'CoinbaseOnrampQuote';
765773
/** Fee charged by Coinbase. */
@@ -795,25 +803,6 @@ export type CoinbaseOnrampQuoteInput = {
795803
subdivision?: InputMaybe<Scalars['String']>;
796804
};
797805

798-
/** Indicates what user information is required for Coinbase onramp. */
799-
export type CoinbaseOnrampRequirements = {
800-
__typename?: 'CoinbaseOnrampRequirements';
801-
/** True if the user needs to provide an email address. */
802-
needsEmail: Scalars['Boolean'];
803-
/** True if the user needs to provide a valid US phone number. */
804-
needsPhoneNumber: Scalars['Boolean'];
805-
/** True if the user's phone number needs to be (re)verified. */
806-
needsPhoneVerification: Scalars['Boolean'];
807-
};
808-
809-
export type CoinbaseOnrampSession = {
810-
__typename?: 'CoinbaseOnrampSession';
811-
/** The single-use Coinbase onramp URL. This URL can only be used once. */
812-
onrampUrl: Scalars['String'];
813-
/** The session token (for reference, already embedded in the URL). */
814-
sessionToken: Scalars['String'];
815-
};
816-
817806
export enum CoinbaseOnrampStatus {
818807
Completed = 'COMPLETED',
819808
Failed = 'FAILED',
@@ -871,8 +860,6 @@ export type CoinbaseTransactionsInput = {
871860
pageSize?: InputMaybe<Scalars['Int']>;
872861
/** If true, use sandbox mode to query sandbox transactions. */
873862
sandbox?: InputMaybe<Scalars['Boolean']>;
874-
/** The controller username to get transactions for. */
875-
username: Scalars['String'];
876863
};
877864

878865
export type CoinbaseTransactionsResponse = {
@@ -1075,49 +1062,13 @@ export type ControllerWhereInput = {
10751062
};
10761063

10771064
export type CreateCoinbaseOnrampOrderInput = {
1078-
/** The IP address of the end user (required for compliance). */
1079-
clientIp?: InputMaybe<Scalars['String']>;
1080-
/** The destination wallet address on Base to receive the USDC. */
1081-
destinationAddress: Scalars['String'];
1082-
/**
1083-
* The domain where the Apple Pay button will be rendered.
1084-
* Required when embedding the payment link in an iframe.
1085-
*/
1086-
domain?: InputMaybe<Scalars['String']>;
1087-
/**
1088-
* The amount of fiat currency to pay (e.g., "100.00" for $100 USD).
1089-
* Either paymentAmount or purchaseAmount must be provided.
1090-
*/
1091-
paymentAmount?: InputMaybe<Scalars['String']>;
1092-
/** The fiat currency to pay with. Currently only "USD" is supported. */
1093-
paymentCurrency: Scalars['String'];
10941065
/**
10951066
* The amount of USDC to purchase (e.g., "100.000000" for 100 USDC).
1096-
* Either paymentAmount or purchaseAmount must be provided.
1067+
* This is the amount that will be delivered to the bridge.
10971068
*/
1098-
purchaseAmount?: InputMaybe<Scalars['String']>;
1099-
/** If true, use sandbox mode for testing (no real charges). */
1069+
purchaseUSDCAmount: Scalars['String'];
1070+
/** If true, use sandbox mode (Base Sepolia -> Starknet Sepolia). */
11001071
sandbox?: InputMaybe<Scalars['Boolean']>;
1101-
/** The controller username to create the onramp order for. */
1102-
username: Scalars['String'];
1103-
};
1104-
1105-
export type CreateCoinbaseOnrampSessionInput = {
1106-
/** The IP address of the end user (required for compliance). */
1107-
clientIp: Scalars['String'];
1108-
/** The destination wallet address to receive the crypto. */
1109-
destinationAddress: Scalars['String'];
1110-
/** The destination network (e.g., "base", "ethereum"). */
1111-
destinationNetwork: CoinbaseNetwork;
1112-
/**
1113-
* The amount of fiat currency to pay (e.g., "100.00" for $100 USD).
1114-
* Optional - if provided, creates a one-click buy URL.
1115-
*/
1116-
paymentAmount?: InputMaybe<Scalars['String']>;
1117-
/** The fiat currency to pay with (e.g., "USD"). Required if paymentAmount is provided. */
1118-
paymentCurrency?: InputMaybe<Scalars['String']>;
1119-
/** URL to redirect the user after completing the purchase. */
1120-
redirectUrl?: InputMaybe<Scalars['String']>;
11211072
};
11221073

11231074
export type CreateCryptoPaymentInput = {
@@ -2564,16 +2515,10 @@ export type Mutation = {
25642515
beginRegistration: Scalars['JSON'];
25652516
claimFreeStarterpack: Scalars['String'];
25662517
/**
2567-
* Create a Coinbase onramp order for purchasing USDC via Apple Pay.
2568-
* Returns a payment link URL that can be used to complete the purchase.
2518+
* Create a unified Coinbase onramp order.
2519+
* This mutation orchestrates both Coinbase and Layerswap to bridge USDC from Apple Pay to Starknet.
25692520
*/
2570-
createCoinbaseOnrampOrder: CoinbaseOnrampOrder;
2571-
/**
2572-
* Create a Coinbase onramp session with a single-use URL.
2573-
* This is the recommended approach for integrating Coinbase onramp.
2574-
* Returns a session token and URL that can be used once to complete a purchase.
2575-
*/
2576-
createCoinbaseOnrampSession: CoinbaseOnrampSession;
2521+
createCoinbaseOnrampOrder: CoinbaseOnrampOrderResponse;
25772522
createCryptoPayment: CryptoPayment;
25782523
createDeployment: Deployment;
25792524
createLayerswapDeposit: LayerswapPayment;
@@ -2673,11 +2618,6 @@ export type MutationCreateCoinbaseOnrampOrderArgs = {
26732618
};
26742619

26752620

2676-
export type MutationCreateCoinbaseOnrampSessionArgs = {
2677-
input: CreateCoinbaseOnrampSessionInput;
2678-
};
2679-
2680-
26812621
export type MutationCreateCryptoPaymentArgs = {
26822622
input: CreateCryptoPaymentInput;
26832623
};
@@ -3991,12 +3931,6 @@ export type Query = {
39913931
* This is an estimate only and does not guarantee the final price.
39923932
*/
39933933
coinbaseOnrampQuote: CoinbaseOnrampQuote;
3994-
/**
3995-
* Check if a user has the required information for Coinbase onramp.
3996-
* Returns flags indicating what information is missing or needs to be updated.
3997-
* Does not expose any user data.
3998-
*/
3999-
coinbaseOnrampRequirements: CoinbaseOnrampRequirements;
40003934
/**
40013935
* Get the status and history of Coinbase onramp transactions for a user.
40023936
* Returns a paginated list of transactions in reverse chronological order.
@@ -4102,11 +4036,6 @@ export type QueryCoinbaseOnrampQuoteArgs = {
41024036
};
41034037

41044038

4105-
export type QueryCoinbaseOnrampRequirementsArgs = {
4106-
username: Scalars['String'];
4107-
};
4108-
4109-
41104039
export type QueryCoinbaseOnrampTransactionsArgs = {
41114040
input: CoinbaseTransactionsInput;
41124041
};
@@ -6898,13 +6827,6 @@ export type LayerswapStatusQueryVariables = Exact<{
68986827

68996828
export type LayerswapStatusQuery = { __typename?: 'Query', layerswapStatus: LayerswapStatus };
69006829

6901-
export type CoinbaseOnrampRequirementsQueryVariables = Exact<{
6902-
username: Scalars['String'];
6903-
}>;
6904-
6905-
6906-
export type CoinbaseOnrampRequirementsQuery = { __typename?: 'Query', coinbaseOnrampRequirements: { __typename?: 'CoinbaseOnrampRequirements', needsEmail: boolean, needsPhoneNumber: boolean, needsPhoneVerification: boolean } };
6907-
69086830
export type CoinbaseOnrampTransactionsQueryVariables = Exact<{
69096831
input: CoinbaseTransactionsInput;
69106832
}>;
@@ -6917,7 +6839,7 @@ export type CreateCoinbaseOnRampOrderMutationVariables = Exact<{
69176839
}>;
69186840

69196841

6920-
export type CreateCoinbaseOnRampOrderMutation = { __typename?: 'Mutation', createCoinbaseOnrampOrder: { __typename?: 'CoinbaseOnrampOrder', orderId: string, paymentLink: string, paymentLinkType: string, paymentSubtotal: string, paymentTotal: string, purchaseAmount: string, purchaseCurrency: string, status: CoinbaseOnrampStatus, fees: Array<{ __typename?: 'CoinbaseOnrampFee', type: string, amount: string, currency: string }> } };
6842+
export type CreateCoinbaseOnRampOrderMutation = { __typename?: 'Mutation', createCoinbaseOnrampOrder: { __typename?: 'CoinbaseOnrampOrderResponse', coinbaseOrder: { __typename?: 'CoinbaseOnrampOrder', orderId: string, paymentLink: string, paymentLinkType: string, paymentTotal: string, paymentCurrency: string, purchaseAmount: string, purchaseCurrency: string, destinationAddress: string, destinationNetwork: string, fees: Array<{ __typename?: 'CoinbaseOnrampFee', type: string, amount: string, currency: string }> }, layerswapPayment: { __typename?: 'LayerswapPayment', swapId: string, cryptoPaymentId: string, sourceNetwork: LayerswapSourceNetwork, sourceTokenAmount: string, sourceTokenAddress: string, sourceDepositAddress: string, expiresAt: string } } };
69216843

69226844
export type PlaythroughsQueryVariables = Exact<{
69236845
projects: Array<PlaythroughProject> | PlaythroughProject;
@@ -8034,27 +7956,6 @@ export const useLayerswapStatusQuery = <
80347956
useFetchData<LayerswapStatusQuery, LayerswapStatusQueryVariables>(LayerswapStatusDocument).bind(null, variables),
80357957
options
80367958
);
8037-
export const CoinbaseOnrampRequirementsDocument = `
8038-
query CoinbaseOnrampRequirements($username: String!) {
8039-
coinbaseOnrampRequirements(username: $username) {
8040-
needsEmail
8041-
needsPhoneNumber
8042-
needsPhoneVerification
8043-
}
8044-
}
8045-
`;
8046-
export const useCoinbaseOnrampRequirementsQuery = <
8047-
TData = CoinbaseOnrampRequirementsQuery,
8048-
TError = unknown
8049-
>(
8050-
variables: CoinbaseOnrampRequirementsQueryVariables,
8051-
options?: UseQueryOptions<CoinbaseOnrampRequirementsQuery, TError, TData>
8052-
) =>
8053-
useQuery<CoinbaseOnrampRequirementsQuery, TError, TData>(
8054-
['CoinbaseOnrampRequirements', variables],
8055-
useFetchData<CoinbaseOnrampRequirementsQuery, CoinbaseOnrampRequirementsQueryVariables>(CoinbaseOnrampRequirementsDocument).bind(null, variables),
8056-
options
8057-
);
80587959
export const CoinbaseOnrampTransactionsDocument = `
80597960
query CoinbaseOnrampTransactions($input: CoinbaseTransactionsInput!) {
80607961
coinbaseOnrampTransactions(input: $input) {
@@ -8103,18 +8004,30 @@ export const useCoinbaseOnrampTransactionsQuery = <
81038004
export const CreateCoinbaseOnRampOrderDocument = `
81048005
mutation CreateCoinbaseOnRampOrder($input: CreateCoinbaseOnrampOrderInput!) {
81058006
createCoinbaseOnrampOrder(input: $input) {
8106-
orderId
8107-
paymentLink
8108-
paymentLinkType
8109-
paymentSubtotal
8110-
paymentTotal
8111-
purchaseAmount
8112-
purchaseCurrency
8113-
status
8114-
fees {
8115-
type
8116-
amount
8117-
currency
8007+
coinbaseOrder {
8008+
orderId
8009+
paymentLink
8010+
paymentLinkType
8011+
paymentTotal
8012+
paymentCurrency
8013+
purchaseAmount
8014+
purchaseCurrency
8015+
destinationAddress
8016+
destinationNetwork
8017+
fees {
8018+
type
8019+
amount
8020+
currency
8021+
}
8022+
}
8023+
layerswapPayment {
8024+
swapId
8025+
cryptoPaymentId
8026+
sourceNetwork
8027+
sourceTokenAmount
8028+
sourceTokenAddress
8029+
sourceDepositAddress
8030+
expiresAt
81188031
}
81198032
}
81208033
}

src/utils/api/cartridge/payment.graphql

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ query LayerswapStatus($swapId: ID!, $isMainnet: Boolean) {
9797
layerswapStatus(swapId: $swapId, isMainnet: $isMainnet)
9898
}
9999

100-
query CoinbaseOnrampRequirements($username: String!) {
101-
coinbaseOnrampRequirements(username: $username) {
102-
needsEmail
103-
needsPhoneNumber
104-
needsPhoneVerification
105-
}
106-
}
107-
108100
query CoinbaseOnrampTransactions($input: CoinbaseTransactionsInput!) {
109101
coinbaseOnrampTransactions(input: $input) {
110102
transactions {
@@ -139,18 +131,31 @@ query CoinbaseOnrampTransactions($input: CoinbaseTransactionsInput!) {
139131

140132
mutation CreateCoinbaseOnRampOrder($input: CreateCoinbaseOnrampOrderInput!) {
141133
createCoinbaseOnrampOrder(input: $input) {
142-
orderId
143-
paymentLink
144-
paymentLinkType
145-
paymentSubtotal
146-
paymentTotal
147-
purchaseAmount
148-
purchaseCurrency
149-
status
150-
fees {
151-
type
152-
amount
153-
currency
134+
coinbaseOrder {
135+
orderId
136+
paymentLink
137+
paymentLinkType
138+
paymentTotal
139+
paymentCurrency
140+
purchaseAmount
141+
purchaseCurrency
142+
destinationAddress
143+
destinationNetwork
144+
fees {
145+
type
146+
amount
147+
currency
148+
}
149+
}
150+
151+
layerswapPayment {
152+
swapId
153+
cryptoPaymentId
154+
sourceNetwork
155+
sourceTokenAmount
156+
sourceTokenAddress
157+
sourceDepositAddress
158+
expiresAt
154159
}
155160
}
156161
}

0 commit comments

Comments
 (0)