Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/keychain/src/hooks/starterpack/layerswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ export function useLayerswap({
const input = depositToLayerswapInput(
requestedAmount,
0, // Fees will be fetched and added
controller.username(),
selectedPlatform,
isMainnet,
);
Expand Down
52 changes: 36 additions & 16 deletions packages/keychain/src/utils/api/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ export type Activity = Node & {
status: ActivityStatus;
/** Transaction hash if this is a blockchain transaction */
transactionHash?: Maybe<Scalars["String"]>;
/** External transaction tracking ID for sponsored transactions */
transactionID?: Maybe<Scalars["String"]>;
/** Type of activity */
type: ActivityType;
updatedAt: Scalars["Time"];
Expand Down Expand Up @@ -645,6 +647,22 @@ export type ActivityWhereInput = {
transactionHashNEQ?: InputMaybe<Scalars["String"]>;
transactionHashNotIn?: InputMaybe<Array<Scalars["String"]>>;
transactionHashNotNil?: InputMaybe<Scalars["Boolean"]>;
/** transaction_id field predicates */
transactionID?: InputMaybe<Scalars["String"]>;
transactionIDContains?: InputMaybe<Scalars["String"]>;
transactionIDContainsFold?: InputMaybe<Scalars["String"]>;
transactionIDEqualFold?: InputMaybe<Scalars["String"]>;
transactionIDGT?: InputMaybe<Scalars["String"]>;
transactionIDGTE?: InputMaybe<Scalars["String"]>;
transactionIDHasPrefix?: InputMaybe<Scalars["String"]>;
transactionIDHasSuffix?: InputMaybe<Scalars["String"]>;
transactionIDIn?: InputMaybe<Array<Scalars["String"]>>;
transactionIDIsNil?: InputMaybe<Scalars["Boolean"]>;
transactionIDLT?: InputMaybe<Scalars["String"]>;
transactionIDLTE?: InputMaybe<Scalars["String"]>;
transactionIDNEQ?: InputMaybe<Scalars["String"]>;
transactionIDNotIn?: InputMaybe<Array<Scalars["String"]>>;
transactionIDNotNil?: InputMaybe<Scalars["Boolean"]>;
/** type field predicates */
type?: InputMaybe<ActivityType>;
typeIn?: InputMaybe<Array<ActivityType>>;
Expand All @@ -661,6 +679,14 @@ export type ActivityWhereInput = {
updatedAtNotIn?: InputMaybe<Array<Scalars["Time"]>>;
};

export enum AdminBudgetReason {
Advance = "ADVANCE",
Correction = "CORRECTION",
Promotion = "PROMOTION",
Refund = "REFUND",
Settlement = "SETTLEMENT",
}

export type AssetEdge = {
__typename?: "AssetEdge";
amount: Scalars["Float"];
Expand Down Expand Up @@ -772,6 +798,8 @@ export type CoinbaseOnrampQuote = {
__typename?: "CoinbaseOnrampQuote";
/** Fee charged by Coinbase. */
coinbaseFee: CoinbaseAmount;
/** Fees charged by Layerswap for bridging. */
layerswapFees: CoinbaseAmount;
/** Network fee for sending the crypto. */
networkFee: CoinbaseAmount;
/** Ready-to-use one-click-buy URL. Only returned when destinationAddress is provided. */
Expand All @@ -787,20 +815,10 @@ export type CoinbaseOnrampQuote = {
};

export type CoinbaseOnrampQuoteInput = {
/** The client's IP address. Required by Coinbase for compliance. */
clientIP: Scalars["String"];
/** ISO 3166-1 two-digit country code (e.g., "US"). */
country: Scalars["String"];
/** Optional destination wallet address. If provided, the response will include a one-click-buy URL. */
destinationAddress?: InputMaybe<Scalars["String"]>;
/** The destination network for the USDC purchase. */
destinationNetwork: CoinbaseNetwork;
/** The amount of fiat currency to pay (e.g., "100.00" for $100 USD). */
paymentAmount: Scalars["String"];
/** The fiat currency to pay with (e.g., "USD"). */
paymentCurrency: Scalars["String"];
/** ISO 3166-2 subdivision code (e.g., "NY"). Required for US users. */
subdivision?: InputMaybe<Scalars["String"]>;
/** The amount of USDC to purchase (e.g., "100.00" for 100 USDC). */
purchaseUSDCAmount: Scalars["String"];
/** If true, use sandbox mode to get a quote for testnet bridging. */
sandbox?: InputMaybe<Scalars["Boolean"]>;
};

export enum CoinbaseOnrampStatus {
Expand Down Expand Up @@ -1085,7 +1103,6 @@ export type CreateLayerswapDepositInput = {
layerswapFees?: InputMaybe<Scalars["BigInt"]>;
marginPercent?: InputMaybe<Scalars["Int"]>;
sourceNetwork: LayerswapSourceNetwork;
username: Scalars["String"];
};

export type CreateLayerswapPaymentInput = {
Expand All @@ -1096,7 +1113,6 @@ export type CreateLayerswapPaymentInput = {
sourceNetwork: LayerswapSourceNetwork;
starterpackId?: InputMaybe<Scalars["ID"]>;
teamId?: InputMaybe<Scalars["ID"]>;
username: Scalars["String"];
};

/**
Expand Down Expand Up @@ -2678,8 +2694,10 @@ export type MutationCreateTeamArgs = {
};

export type MutationDecreaseBudgetArgs = {
admin?: InputMaybe<Scalars["Boolean"]>;
amount: Scalars["Int"];
paymasterName: Scalars["ID"];
reason?: InputMaybe<AdminBudgetReason>;
unit: FeeUnit;
};

Expand Down Expand Up @@ -2719,8 +2737,10 @@ export type MutationFinalizeRegistrationArgs = {
};

export type MutationIncreaseBudgetArgs = {
admin?: InputMaybe<Scalars["Boolean"]>;
amount: Scalars["Int"];
paymasterName: Scalars["ID"];
reason?: InputMaybe<AdminBudgetReason>;
unit: FeeUnit;
};

Expand Down
7 changes: 1 addition & 6 deletions packages/keychain/src/utils/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import { mapPlatformToLayerswapSourceNetwork } from "@/hooks/starterpack/layersw
*
* @param amount The deposit amount.
* @param layerswapFees The Layerswap fees.
* @param username The user's username.
* @param platform The source platform for the payment.
* @param isMainnet Whether the transaction is for mainnet or testnet.
* @returns A CreateLayerswapDepositInput object.
*/
export function depositToLayerswapInput(
amount: number,
layerswapFees: number,
username: string,
platform: ExternalPlatform,
isMainnet: boolean,
): CreateLayerswapDepositInput {
Expand All @@ -32,23 +30,21 @@ export function depositToLayerswapInput(
return {
amount: amount.toString(),
layerswapFees: layerswapFees.toString(),
username,
sourceNetwork,
};
}

/**
* Converts a credits purchase to a CreateLayerswapPaymentInput object.
*
* @param username The user's username.
* @param starterpackId An optional starterpack ID.
* @param platform The source platform for the payment.
* @param isMainnet Whether the transaction is for mainnet or testnet.
* @param wholeCredits The amount of credits to purchase.
* @param teamId An optional team ID.
* @returns A CreateLayerswapPaymentInput object.
*/
export function creditsPurchaseToLayerswapInput(
username: string,
starterpackId: string | undefined,
platform: ExternalPlatform,
isMainnet: boolean,
Expand All @@ -64,7 +60,6 @@ export function creditsPurchaseToLayerswapInput(
: LayerswapDestinationNetwork.StarknetSepolia;

return {
username,
sourceNetwork,
destinationNetwork,
purchaseType: PurchaseType.Credits,
Expand Down
Loading