diff --git a/README.md b/README.md index e8f5d5451..8b621d190 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ The `RAPYD_ACCESS_KEY` and `RAPYD_SECRET_KEY` variables values can be found in y To create a new Interledger Test Wallet account, a verification email will be sent to the provided email address. If you want to send emails within the development environment, you will need to have a personal Sendgrid account and update the following environment variables: `SEND_EMAIL` to `true`, `SENDGRID_API_KEY` and `FROM_EMAIL`. If you prefer not to send emails in the development environment, simply set `SEND_EMAIL` to `false` and use the verification link found in the Docker `wallet-backend` container logs to finalize the registration process for a new user. Cross-currency transactions are supported. To enable this functionality, you will need to register at [freecurrencyapi.com/](https://freecurrencyapi.com/) and update the `RATE_API_KEY` environment variable with your own API key. -Currencies can be added in the `admin` environment. For example `assetCode` is `EUR`, `assetScale` is `2`, and you will need to add an amount to `liquidity`. +Currencies can be added in the `admin` environment. For example `assetCode` is `EUR`, `assetScale` is `9`, and you will need to add an amount to `liquidity`. To have everything ready for `DEV` environment, we already set up some default values for Interledger Test Wallet, this way developers are ready to login without validation, and test e-commerce application without any additional setup: diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml index 51d3bac17..7e338705f 100644 --- a/docker/dev/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -54,7 +54,7 @@ services: RATE_API_KEY: ${RATE_API_KEY} BASE_ASSET_SCALE: 2 MAX_ASSET_SCALE: 9 - WM_THRESHOLD: 100000000 + RAPYD_THRESHOLD: 10000000 # 0.01 DEBT_THRESHOLD: 5 REDIS_URL: redis://redis:6379/0 restart: always diff --git a/docker/prod/.env.example b/docker/prod/.env.example index 9d6b62958..78ccb7b20 100644 --- a/docker/prod/.env.example +++ b/docker/prod/.env.example @@ -33,7 +33,7 @@ WALLET_BACKEND_AUTH_DOMAIN= WALLET_BACKEND_RATE_API_KEY= WALLET_BACKEND_BASE_ASSET_SCALE= WALLET_BACKEND_MAX_ASSET_SCALE= -WALLET_BACKEND_WM_THRESHOLD= +WALLET_BACKEND_RAPYD_THRESHOLD= WALLET_BACKEND_DEBT_THRESHOLD= # BOUTIQUE diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 97846b920..b64977260 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -67,7 +67,7 @@ services: RATE_API_KEY: ${WALLET_BACKEND_RATE_API_KEY} BASE_ASSET_SCALE: ${WALLET_BACKEND_BASE_ASSET_SCALE} MAX_ASSET_SCALE: ${WALLET_BACKEND_MAX_ASSET_SCALE} - WM_THRESHOLD: ${WALLET_BACKEND_WM_THRESHOLD} + RAPYD_THRESHOLD: ${WALLET_BACKEND_RAPYD_THRESHOLD} DEBT_THRESHOLD: ${WALLET_BACKEND_DEBT_THRESHOLD} REDIS_URL: ${WALLET_BACKEND_REDIS_URL} networks: diff --git a/packages/wallet/backend/knexfile.js b/packages/wallet/backend/knexfile.js index 8f481de7b..41d70d884 100644 --- a/packages/wallet/backend/knexfile.js +++ b/packages/wallet/backend/knexfile.js @@ -20,6 +20,20 @@ module.exports = { } }, + rafiki_backend: { + client: 'postgresql', + connection: { + host: 'postgres', + user: 'postgres', + password: 'password', + database: 'rafiki_backend' + }, + pool: { + min: 2, + max: 10 + } + }, + testing: { client: 'postgresql', connection: { diff --git a/packages/wallet/backend/migrations/20240801155211_update_asset_scale.js b/packages/wallet/backend/migrations/20240801155211_update_asset_scale.js new file mode 100644 index 000000000..ea1e7d532 --- /dev/null +++ b/packages/wallet/backend/migrations/20240801155211_update_asset_scale.js @@ -0,0 +1,112 @@ +const Knex = require('knex') +const knexConfig = require('../knexfile') + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = async function (knex) { + if (process.env.NODE_ENV !== 'test') { + const rafikiKnex = Knex(knexConfig.rafiki_backend) + + try { + const assets = await rafikiKnex('assets').distinct('code') + + for (const asset of assets) { + const { code } = asset + + const existingAssetWithScale9 = await rafikiKnex('assets') + .where({ code, scale: 9 }) + .first() + + if (existingAssetWithScale9) { + await knex('accounts') + .where({ assetCode: code, assetScale: 2 }) + .update({ + assetId: existingAssetWithScale9.id, + assetScale: 9 + }) + } else { + await rafikiKnex('assets') + .where({ code, scale: 2 }) + .update({ scale: 9 }) + } + } + } finally { + await rafikiKnex.destroy() + } + } + + const walletAddresses = await knex('walletAddresses').select( + 'id', + 'accountId' + ) + for (const walletAddress of walletAddresses) { + const account = await knex('accounts') + .where('id', walletAddress.accountId) + .first() + if (account) { + await knex('walletAddresses') + .where('id', walletAddress.id) + .update({ assetCode: account.assetCode }) + } + } + + await knex('walletAddresses').update({ assetScale: 9 }) + await knex('accounts').update({ assetScale: 9 }) +} + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = async function (knex) { + if (process.env.NODE_ENV !== 'test') { + const rafikiKnex = Knex(knexConfig.rafiki_backend) + + try { + const assets = await rafikiKnex('assets').distinct('code') + + for (const asset of assets) { + const { code } = asset + + const existingAssetWithScale2 = await rafikiKnex('assets') + .where({ code, scale: 2 }) + .first() + + if (existingAssetWithScale2) { + await knex('accounts') + .where({ assetCode: code, assetScale: 9 }) + .update({ + assetId: existingAssetWithScale2.id, + assetScale: 2 + }) + } else { + await rafikiKnex('assets') + .where({ code, scale: 9 }) + .update({ scale: 2 }) + } + } + } finally { + await rafikiKnex.destroy() + } + } + + const walletAddresses = await knex('walletAddresses').select( + 'id', + 'accountId' + ) + for (const walletAddress of walletAddresses) { + const account = await knex('accounts') + .where('id', walletAddress.accountId) + .first() + if (account) { + await knex('walletAddresses') + .where('id', walletAddress.id) + .update({ assetCode: account.assetCode }) + } + } + + await knex('walletAddresses').update({ assetScale: 2 }) + await knex('accounts').update({ assetScale: 2 }) +} diff --git a/packages/wallet/backend/src/account/service.ts b/packages/wallet/backend/src/account/service.ts index 86c606ad7..db6eadd3f 100644 --- a/packages/wallet/backend/src/account/service.ts +++ b/packages/wallet/backend/src/account/service.ts @@ -6,6 +6,7 @@ import { transformBalance } from '@/utils/helpers' import { Transaction } from '@/transaction/model' import { Amount } from '@/rafiki/service' import { Conflict, NotFound } from '@shared/backend' +import { Env } from '@/config/env' type CreateAccountArgs = { userId: string @@ -38,7 +39,8 @@ interface IAccountService { export class AccountService implements IAccountService { constructor( private rapydClient: RapydClient, - private rafikiClient: RafikiClient + private rafikiClient: RafikiClient, + private env: Env ) {} public async createAccount(args: CreateAccountArgs): Promise { @@ -244,7 +246,10 @@ export class AccountService implements IAccountService { accountId: existingAccount.id, paymentId: transactions[transactions.length - 1].id, assetCode: existingAccount.assetCode, - value: transformBalance(args.amount, asset.scale), + value: transformBalance( + args.amount, + this.env.MAX_ASSET_SCALE || asset.scale + ), type: 'INCOMING', status: 'COMPLETED', description: 'Fund account' @@ -304,7 +309,8 @@ export class AccountService implements IAccountService { name = 'USD Account' ): Promise { const asset = (await this.rafikiClient.listAssets({ first: 100 })).find( - (asset) => asset.code === 'USD' && asset.scale === 2 + (asset) => + asset.code === 'USD' && asset.scale === this.env.MAX_ASSET_SCALE ) if (!asset) { return diff --git a/packages/wallet/backend/src/app.ts b/packages/wallet/backend/src/app.ts index ce495f834..3e9301820 100644 --- a/packages/wallet/backend/src/app.ts +++ b/packages/wallet/backend/src/app.ts @@ -38,7 +38,6 @@ import { UserController } from './user/controller' import type { UserService } from './user/service' import { SocketService } from './socket/service' import { GrantService } from '@/grant/service' -import { WMTransactionService } from '@/webMonetization/transaction/service' import { AwilixContainer } from 'awilix' import { Cradle } from '@/createContainer' import { initErrorHandler, RedisClient } from '@shared/backend' @@ -78,7 +77,6 @@ export interface Bindings { grantService: GrantService emailService: EmailService socketService: SocketService - wmTransactionService: WMTransactionService } export class App { @@ -336,24 +334,25 @@ export class App { }) } - private async processWMWalletAddresses() { + private async keepBalancesSynced(lastProcessedTimestamp: Date) { const logger = await this.container.resolve('logger') const walletAddressService = await this.container.resolve( 'walletAddressService' ) return walletAddressService - .processWMWalletAddresses() + .keepBalancesSynced(lastProcessedTimestamp) .catch((e) => { logger.error(e) return false }) .then((trx) => { + const newTimestamp = new Date() if (trx) { - process.nextTick(() => this.processWMWalletAddresses()) + process.nextTick(() => this.keepBalancesSynced(newTimestamp)) } else { setTimeout( - () => this.processWMWalletAddresses(), + () => this.keepBalancesSynced(lastProcessedTimestamp), 1000 * 60 * 5 ).unref() } @@ -362,7 +361,7 @@ export class App { async processResources() { process.nextTick(() => this.processPendingTransactions()) - process.nextTick(() => this.processWMWalletAddresses()) + process.nextTick(() => this.keepBalancesSynced(new Date())) } async createDefaultUsers() { diff --git a/packages/wallet/backend/src/config/env.ts b/packages/wallet/backend/src/config/env.ts index c865c3c47..620e0cfa9 100644 --- a/packages/wallet/backend/src/config/env.ts +++ b/packages/wallet/backend/src/config/env.ts @@ -34,7 +34,7 @@ const envSchema = z.object({ .transform((value) => value === 'true'), BASE_ASSET_SCALE: z.coerce.number().nonnegative().default(2), MAX_ASSET_SCALE: z.coerce.number().nonnegative().default(9), - WM_THRESHOLD: z.coerce.bigint().nonnegative().default(100_000_000n), // $0.1 in asset scale 9 + RAPYD_THRESHOLD: z.coerce.bigint().nonnegative().default(100_000_00n), // $0.01 in asset scale 9 DEBT_THRESHOLD: z.coerce.number().multipleOf(0.01).nonnegative().default(5.0), // $5.00 DEFAULT_WALLET_ACCOUNT: z .object({ diff --git a/packages/wallet/backend/src/createContainer.ts b/packages/wallet/backend/src/createContainer.ts index ae68f488d..8e7c29d36 100644 --- a/packages/wallet/backend/src/createContainer.ts +++ b/packages/wallet/backend/src/createContainer.ts @@ -30,7 +30,6 @@ import { type Knex } from 'knex' import { SocketService } from './socket/service' import { GrantService } from './grant/service' import { RatesService } from './rates/service' -import { WMTransactionService } from '@/webMonetization/transaction/service' import { Logger } from 'winston' import { asClass, @@ -69,7 +68,6 @@ export interface Cradle { accountService: AccountService ratesService: RatesService redisClient: RedisClient - wmTransactionService: WMTransactionService walletAddressService: WalletAddressService walletAddressKeyService: WalletAddressKeyService transactionService: TransactionService @@ -119,10 +117,6 @@ export async function createContainer( accountService: asClass(AccountService).singleton(), ratesService: asClass(RatesService).singleton(), redisClient: asFunction(createRedis).singleton(), - wmTransactionService: asClassSingletonWithLogger( - WMTransactionService, - logger - ), transactionService: asClassSingletonWithLogger(TransactionService, logger), walletAddressService: asClassSingletonWithLogger( WalletAddressService, diff --git a/packages/wallet/backend/src/rafiki/auth/generated/graphql.ts b/packages/wallet/backend/src/rafiki/auth/generated/graphql.ts index 9372ebe6e..69ae8ef6b 100644 --- a/packages/wallet/backend/src/rafiki/auth/generated/graphql.ts +++ b/packages/wallet/backend/src/rafiki/auth/generated/graphql.ts @@ -1,78 +1,91 @@ -export type Maybe = T | null; -export type InputMaybe = T | undefined; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +export type Maybe = T | null +export type InputMaybe = T | undefined +export type Exact = { + [K in keyof T]: T[K] +} +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe +} +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe +} +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T +> = { [_ in K]?: never } +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never + } /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } - BigInt: { input: bigint; output: bigint; } - UInt8: { input: number; output: number; } -}; + ID: { input: string; output: string } + String: { input: string; output: string } + Boolean: { input: boolean; output: boolean } + Int: { input: number; output: number } + Float: { input: number; output: number } + BigInt: { input: bigint; output: bigint } + UInt8: { input: number; output: number } +} export type Access = Model & { - __typename?: 'Access'; + __typename?: 'Access' /** Access action (create, read, list or complete) */ - actions: Array>; + actions: Array> /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Access id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Wallet address of a sub-resource (incoming payment, outgoing payment, or quote) */ - identifier?: Maybe; + identifier?: Maybe /** Payment limits */ - limits?: Maybe; + limits?: Maybe /** Access type (incoming payment, outgoing payment, or quote) */ - type: Scalars['String']['output']; -}; + type: Scalars['String']['output'] +} export type FilterFinalizationReason = { - in?: InputMaybe>; - notIn?: InputMaybe>; -}; + in?: InputMaybe> + notIn?: InputMaybe> +} export type FilterGrantState = { - in?: InputMaybe>; - notIn?: InputMaybe>; -}; + in?: InputMaybe> + notIn?: InputMaybe> +} export type FilterString = { - in?: InputMaybe>; -}; + in?: InputMaybe> +} export type Grant = Model & { - __typename?: 'Grant'; + __typename?: 'Grant' /** Access details */ - access: Array; + access: Array /** Wallet address of the grantee's account */ - client: Scalars['String']['output']; + client: Scalars['String']['output'] /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Reason a grant was finalized */ - finalizationReason?: Maybe; + finalizationReason?: Maybe /** Grant id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** State of the grant */ - state: GrantState; -}; + state: GrantState +} export type GrantEdge = { - __typename?: 'GrantEdge'; - cursor: Scalars['String']['output']; - node: Grant; -}; + __typename?: 'GrantEdge' + cursor: Scalars['String']['output'] + node: Grant +} export type GrantFilter = { - finalizationReason?: InputMaybe; - identifier?: InputMaybe; - state?: InputMaybe; -}; + finalizationReason?: InputMaybe + identifier?: InputMaybe + state?: InputMaybe +} export enum GrantFinalization { /** grant was issued */ @@ -95,91 +108,88 @@ export enum GrantState { } export type GrantsConnection = { - __typename?: 'GrantsConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'GrantsConnection' + edges: Array + pageInfo: PageInfo +} export type LimitData = { - __typename?: 'LimitData'; + __typename?: 'LimitData' /** Amount to debit */ - debitAmount?: Maybe; + debitAmount?: Maybe /** Interval between payments */ - interval?: Maybe; + interval?: Maybe /** Amount to receive */ - receiveAmount?: Maybe; + receiveAmount?: Maybe /** Wallet address URL of the receiver */ - receiver?: Maybe; -}; + receiver?: Maybe +} export type Model = { - createdAt: Scalars['String']['output']; - id: Scalars['ID']['output']; -}; + createdAt: Scalars['String']['output'] + id: Scalars['ID']['output'] +} export type Mutation = { - __typename?: 'Mutation'; + __typename?: 'Mutation' /** Revoke Grant */ - revokeGrant: RevokeGrantMutationResponse; -}; - + revokeGrant: RevokeGrantMutationResponse +} export type MutationRevokeGrantArgs = { - input: RevokeGrantInput; -}; + input: RevokeGrantInput +} export type PageInfo = { - __typename?: 'PageInfo'; + __typename?: 'PageInfo' /** Paginating forwards: the cursor to continue. */ - endCursor?: Maybe; + endCursor?: Maybe /** Paginating forwards: Are there more pages? */ - hasNextPage: Scalars['Boolean']['output']; + hasNextPage: Scalars['Boolean']['output'] /** Paginating backwards: Are there more pages? */ - hasPreviousPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output'] /** Paginating backwards: the cursor to continue. */ - startCursor?: Maybe; -}; + startCursor?: Maybe +} export type PaymentAmount = { - __typename?: 'PaymentAmount'; + __typename?: 'PaymentAmount' /** [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217), e.g. `USD` */ - assetCode: Scalars['String']['output']; + assetCode: Scalars['String']['output'] /** Difference in orders of magnitude between the standard unit of an asset and a corresponding fractional unit */ - assetScale: Scalars['UInt8']['output']; - value: Scalars['BigInt']['output']; -}; + assetScale: Scalars['UInt8']['output'] + value: Scalars['BigInt']['output'] +} export type Query = { - __typename?: 'Query'; + __typename?: 'Query' /** Fetch a grant */ - grant: Grant; + grant: Grant /** Fetch a page of grants. */ - grants: GrantsConnection; -}; - + grants: GrantsConnection +} export type QueryGrantArgs = { - id: Scalars['ID']['input']; -}; - + id: Scalars['ID']['input'] +} export type QueryGrantsArgs = { - after?: InputMaybe; - before?: InputMaybe; - filter?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; + after?: InputMaybe + before?: InputMaybe + filter?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type RevokeGrantInput = { - grantId: Scalars['String']['input']; -}; + grantId: Scalars['String']['input'] +} export type RevokeGrantMutationResponse = { - __typename?: 'RevokeGrantMutationResponse'; - id: Scalars['ID']['output']; -}; + __typename?: 'RevokeGrantMutationResponse' + id: Scalars['ID']['output'] +} export enum SortOrder { /** Choose ascending order for results. */ @@ -189,26 +199,110 @@ export enum SortOrder { } export type GetGrantsQueryVariables = Exact<{ - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - filter?: InputMaybe; -}>; - - -export type GetGrantsQuery = { __typename?: 'Query', grants: { __typename?: 'GrantsConnection', edges: Array<{ __typename?: 'GrantEdge', cursor: string, node: { __typename?: 'Grant', id: string, client: string, state: GrantState, finalizationReason?: GrantFinalization | null, createdAt: string, access: Array<{ __typename?: 'Access', id: string, identifier?: string | null, createdAt: string, actions: Array, type: string, limits?: { __typename?: 'LimitData', receiver?: string | null, interval?: string | null, debitAmount?: { __typename?: 'PaymentAmount', value: bigint, assetCode: string, assetScale: number } | null, receiveAmount?: { __typename?: 'PaymentAmount', value: bigint, assetCode: string, assetScale: number } | null } | null }> } }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null } } }; + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + filter?: InputMaybe +}> + +export type GetGrantsQuery = { + __typename?: 'Query' + grants: { + __typename?: 'GrantsConnection' + edges: Array<{ + __typename?: 'GrantEdge' + cursor: string + node: { + __typename?: 'Grant' + id: string + client: string + state: GrantState + finalizationReason?: GrantFinalization | null + createdAt: string + access: Array<{ + __typename?: 'Access' + id: string + identifier?: string | null + createdAt: string + actions: Array + type: string + limits?: { + __typename?: 'LimitData' + receiver?: string | null + interval?: string | null + debitAmount?: { + __typename?: 'PaymentAmount' + value: bigint + assetCode: string + assetScale: number + } | null + receiveAmount?: { + __typename?: 'PaymentAmount' + value: bigint + assetCode: string + assetScale: number + } | null + } | null + }> + } + }> + pageInfo: { + __typename?: 'PageInfo' + endCursor?: string | null + hasNextPage: boolean + hasPreviousPage: boolean + startCursor?: string | null + } + } +} export type GetGrantQueryVariables = Exact<{ - grantId: Scalars['ID']['input']; -}>; - - -export type GetGrantQuery = { __typename?: 'Query', grant: { __typename?: 'Grant', id: string, client: string, state: GrantState, finalizationReason?: GrantFinalization | null, createdAt: string, access: Array<{ __typename?: 'Access', id: string, identifier?: string | null, createdAt: string, actions: Array, type: string, limits?: { __typename?: 'LimitData', receiver?: string | null, interval?: string | null, debitAmount?: { __typename?: 'PaymentAmount', value: bigint, assetCode: string, assetScale: number } | null, receiveAmount?: { __typename?: 'PaymentAmount', value: bigint, assetCode: string, assetScale: number } | null } | null }> } }; + grantId: Scalars['ID']['input'] +}> + +export type GetGrantQuery = { + __typename?: 'Query' + grant: { + __typename?: 'Grant' + id: string + client: string + state: GrantState + finalizationReason?: GrantFinalization | null + createdAt: string + access: Array<{ + __typename?: 'Access' + id: string + identifier?: string | null + createdAt: string + actions: Array + type: string + limits?: { + __typename?: 'LimitData' + receiver?: string | null + interval?: string | null + debitAmount?: { + __typename?: 'PaymentAmount' + value: bigint + assetCode: string + assetScale: number + } | null + receiveAmount?: { + __typename?: 'PaymentAmount' + value: bigint + assetCode: string + assetScale: number + } | null + } | null + }> + } +} export type RevokeGrantMutationVariables = Exact<{ - grantId: Scalars['String']['input']; -}>; + grantId: Scalars['String']['input'] +}> - -export type RevokeGrantMutation = { __typename?: 'Mutation', revokeGrant: { __typename?: 'RevokeGrantMutationResponse', id: string } }; +export type RevokeGrantMutation = { + __typename?: 'Mutation' + revokeGrant: { __typename?: 'RevokeGrantMutationResponse'; id: string } +} diff --git a/packages/wallet/backend/src/rafiki/backend/generated/graphql.ts b/packages/wallet/backend/src/rafiki/backend/generated/graphql.ts index a232bdd35..373d44c84 100644 --- a/packages/wallet/backend/src/rafiki/backend/generated/graphql.ts +++ b/packages/wallet/backend/src/rafiki/backend/generated/graphql.ts @@ -1,333 +1,345 @@ -export type Maybe = T | null; -export type InputMaybe = T | undefined; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +export type Maybe = T | null +export type InputMaybe = T | undefined +export type Exact = { + [K in keyof T]: T[K] +} +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe +} +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe +} +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T +> = { [_ in K]?: never } +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never + } /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } - BigInt: { input: bigint; output: bigint; } - JSONObject: { input: any; output: any; } - UInt8: { input: number; output: number; } -}; + ID: { input: string; output: string } + String: { input: string; output: string } + Boolean: { input: boolean; output: boolean } + Int: { input: number; output: number } + Float: { input: number; output: number } + BigInt: { input: bigint; output: bigint } + JSONObject: { input: any; output: any } + UInt8: { input: number; output: number } +} export type AdditionalProperty = { - __typename?: 'AdditionalProperty'; - key: Scalars['String']['output']; - value: Scalars['String']['output']; - visibleInOpenPayments: Scalars['Boolean']['output']; -}; + __typename?: 'AdditionalProperty' + key: Scalars['String']['output'] + value: Scalars['String']['output'] + visibleInOpenPayments: Scalars['Boolean']['output'] +} export type AdditionalPropertyInput = { - key: Scalars['String']['input']; - value: Scalars['String']['input']; - visibleInOpenPayments: Scalars['Boolean']['input']; -}; + key: Scalars['String']['input'] + value: Scalars['String']['input'] + visibleInOpenPayments: Scalars['Boolean']['input'] +} export enum Alg { EdDsa = 'EdDSA' } export type Amount = { - __typename?: 'Amount'; + __typename?: 'Amount' /** [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217), e.g. `USD` */ - assetCode: Scalars['String']['output']; + assetCode: Scalars['String']['output'] /** Difference in orders of magnitude between the standard unit of an asset and a corresponding fractional unit */ - assetScale: Scalars['UInt8']['output']; - value: Scalars['BigInt']['output']; -}; + assetScale: Scalars['UInt8']['output'] + value: Scalars['BigInt']['output'] +} export type AmountInput = { /** [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217), e.g. `USD` */ - assetCode: Scalars['String']['input']; + assetCode: Scalars['String']['input'] /** Difference in orders of magnitude between the standard unit of an asset and a corresponding fractional unit */ - assetScale: Scalars['UInt8']['input']; - value: Scalars['BigInt']['input']; -}; + assetScale: Scalars['UInt8']['input'] + value: Scalars['BigInt']['input'] +} export type Asset = Model & { - __typename?: 'Asset'; + __typename?: 'Asset' /** [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217), e.g. `USD` */ - code: Scalars['String']['output']; + code: Scalars['String']['output'] /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Fetch a page of asset fees */ - fees?: Maybe; + fees?: Maybe /** Asset id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Available liquidity */ - liquidity?: Maybe; + liquidity?: Maybe /** Account Servicing Entity will be notified via a webhook event if liquidity falls below this value */ - liquidityThreshold?: Maybe; + liquidityThreshold?: Maybe /** The receiving fee structure for the asset */ - receivingFee?: Maybe; + receivingFee?: Maybe /** Difference in orders of magnitude between the standard unit of an asset and a corresponding fractional unit */ - scale: Scalars['UInt8']['output']; + scale: Scalars['UInt8']['output'] /** The sending fee structure for the asset */ - sendingFee?: Maybe; + sendingFee?: Maybe /** Minimum amount of liquidity that can be withdrawn from the asset */ - withdrawalThreshold?: Maybe; -}; - + withdrawalThreshold?: Maybe +} export type AssetFeesArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type AssetEdge = { - __typename?: 'AssetEdge'; - cursor: Scalars['String']['output']; - node: Asset; -}; + __typename?: 'AssetEdge' + cursor: Scalars['String']['output'] + node: Asset +} export type AssetMutationResponse = { - __typename?: 'AssetMutationResponse'; - asset?: Maybe; -}; + __typename?: 'AssetMutationResponse' + asset?: Maybe +} export type AssetsConnection = { - __typename?: 'AssetsConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'AssetsConnection' + edges: Array + pageInfo: PageInfo +} export type BasePayment = { - client?: Maybe; - createdAt: Scalars['String']['output']; - id: Scalars['ID']['output']; - metadata?: Maybe; - walletAddressId: Scalars['ID']['output']; -}; + client?: Maybe + createdAt: Scalars['String']['output'] + id: Scalars['ID']['output'] + metadata?: Maybe + walletAddressId: Scalars['ID']['output'] +} export type CancelOutgoingPaymentInput = { /** Outgoing payment id */ - id: Scalars['ID']['input']; + id: Scalars['ID']['input'] /** Reason why this Outgoing Payment has been cancelled. This value will be publicly visible in the metadata field if this outgoing payment is requested through Open Payments. */ - reason?: InputMaybe; -}; + reason?: InputMaybe +} export type CreateAssetInput = { /** [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217), e.g. `USD` */ - code: Scalars['String']['input']; + code: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Account Servicing Entity will be notified via a webhook event if liquidity falls below this value */ - liquidityThreshold?: InputMaybe; + liquidityThreshold?: InputMaybe /** Difference in orders of magnitude between the standard unit of an asset and a corresponding fractional unit */ - scale: Scalars['UInt8']['input']; + scale: Scalars['UInt8']['input'] /** Minimum amount of liquidity that can be withdrawn from the asset */ - withdrawalThreshold?: InputMaybe; -}; + withdrawalThreshold?: InputMaybe +} export type CreateAssetLiquidityWithdrawalInput = { /** Amount of withdrawal. */ - amount: Scalars['BigInt']['input']; + amount: Scalars['BigInt']['input'] /** The id of the asset to create the withdrawal for. */ - assetId: Scalars['String']['input']; + assetId: Scalars['String']['input'] /** The id of the withdrawal. */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** This is the interval in seconds after a pending transfer's created at which it may be posted or voided. Zero denotes a no timeout single-phase posted transfer. */ - timeoutSeconds: Scalars['BigInt']['input']; -}; + timeoutSeconds: Scalars['BigInt']['input'] +} export type CreateIncomingPaymentInput = { /** Expiration date-time */ - expiresAt?: InputMaybe; + expiresAt?: InputMaybe /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Maximum amount to be received */ - incomingAmount?: InputMaybe; + incomingAmount?: InputMaybe /** Additional metadata associated with the incoming payment. */ - metadata?: InputMaybe; + metadata?: InputMaybe /** Id of the wallet address under which the incoming payment will be created */ - walletAddressId: Scalars['String']['input']; -}; + walletAddressId: Scalars['String']['input'] +} export type CreateIncomingPaymentWithdrawalInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the incoming payment to withdraw from. */ - incomingPaymentId: Scalars['String']['input']; + incomingPaymentId: Scalars['String']['input'] /** This is the interval in seconds after a pending transfer's created at which it may be posted or voided. Zero denotes a no timeout single-phase posted transfer. */ - timeoutSeconds: Scalars['BigInt']['input']; -}; + timeoutSeconds: Scalars['BigInt']['input'] +} export type CreateOrUpdatePeerByUrlInput = { /** Asset id of peering relationship */ - assetId: Scalars['String']['input']; + assetId: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Account Servicing Entity will be notified via a webhook event if peer liquidity falls below this value */ - liquidityThreshold?: InputMaybe; + liquidityThreshold?: InputMaybe /** Amount of liquidity to deposit for peer */ - liquidityToDeposit?: InputMaybe; + liquidityToDeposit?: InputMaybe /** Maximum packet amount that the peer accepts */ - maxPacketAmount?: InputMaybe; + maxPacketAmount?: InputMaybe /** Peer's internal name for overriding auto-peer's default naming */ - name?: InputMaybe; + name?: InputMaybe /** Peer's URL address at which the peer accepts auto-peering requests */ - peerUrl: Scalars['String']['input']; -}; + peerUrl: Scalars['String']['input'] +} export type CreateOrUpdatePeerByUrlMutationResponse = { - __typename?: 'CreateOrUpdatePeerByUrlMutationResponse'; - peer?: Maybe; -}; + __typename?: 'CreateOrUpdatePeerByUrlMutationResponse' + peer?: Maybe +} export type CreateOutgoingPaymentFromIncomingPaymentInput = { /** Amount to send (fixed send) */ - debitAmount: AmountInput; + debitAmount: AmountInput /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Incoming payment url to create the outgoing payment from */ - incomingPayment: Scalars['String']['input']; + incomingPayment: Scalars['String']['input'] /** Additional metadata associated with the outgoing payment. */ - metadata?: InputMaybe; + metadata?: InputMaybe /** Id of the wallet address under which the outgoing payment will be created */ - walletAddressId: Scalars['String']['input']; -}; + walletAddressId: Scalars['String']['input'] +} export type CreateOutgoingPaymentInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Additional metadata associated with the outgoing payment. */ - metadata?: InputMaybe; + metadata?: InputMaybe /** Id of the corresponding quote for that outgoing payment */ - quoteId: Scalars['String']['input']; + quoteId: Scalars['String']['input'] /** Id of the wallet address under which the outgoing payment will be created */ - walletAddressId: Scalars['String']['input']; -}; + walletAddressId: Scalars['String']['input'] +} export type CreateOutgoingPaymentWithdrawalInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the outgoing payment to withdraw from. */ - outgoingPaymentId: Scalars['String']['input']; + outgoingPaymentId: Scalars['String']['input'] /** This is the interval in seconds after a pending transfer's created at which it may be posted or voided. Zero denotes a no timeout single-phase posted transfer. */ - timeoutSeconds: Scalars['BigInt']['input']; -}; + timeoutSeconds: Scalars['BigInt']['input'] +} export type CreatePeerInput = { /** Asset id of peering relationship */ - assetId: Scalars['String']['input']; + assetId: Scalars['String']['input'] /** Peering connection details */ - http: HttpInput; + http: HttpInput /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Initial amount of liquidity to deposit for peer */ - initialLiquidity?: InputMaybe; + initialLiquidity?: InputMaybe /** Account Servicing Entity will be notified via a webhook event if peer liquidity falls below this value */ - liquidityThreshold?: InputMaybe; + liquidityThreshold?: InputMaybe /** Maximum packet amount that the peer accepts */ - maxPacketAmount?: InputMaybe; + maxPacketAmount?: InputMaybe /** Peer's internal name */ - name?: InputMaybe; + name?: InputMaybe /** Peer's ILP address */ - staticIlpAddress: Scalars['String']['input']; -}; + staticIlpAddress: Scalars['String']['input'] +} export type CreatePeerLiquidityWithdrawalInput = { /** Amount of withdrawal. */ - amount: Scalars['BigInt']['input']; + amount: Scalars['BigInt']['input'] /** The id of the withdrawal. */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the peer to create the withdrawal for. */ - peerId: Scalars['String']['input']; + peerId: Scalars['String']['input'] /** This is the interval in seconds after a pending transfer's created at which it may be posted or voided. Zero denotes a no timeout single-phase posted transfer. */ - timeoutSeconds: Scalars['BigInt']['input']; -}; + timeoutSeconds: Scalars['BigInt']['input'] +} export type CreatePeerMutationResponse = { - __typename?: 'CreatePeerMutationResponse'; - peer?: Maybe; -}; + __typename?: 'CreatePeerMutationResponse' + peer?: Maybe +} export type CreateQuoteInput = { /** Amount to send (fixed send) */ - debitAmount?: InputMaybe; + debitAmount?: InputMaybe /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Amount to receive (fixed receive) */ - receiveAmount?: InputMaybe; + receiveAmount?: InputMaybe /** Wallet address URL of the receiver */ - receiver: Scalars['String']['input']; + receiver: Scalars['String']['input'] /** Id of the wallet address under which the quote will be created */ - walletAddressId: Scalars['String']['input']; -}; + walletAddressId: Scalars['String']['input'] +} export type CreateReceiverInput = { /** Expiration date-time */ - expiresAt?: InputMaybe; + expiresAt?: InputMaybe /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Maximum amount to be received */ - incomingAmount?: InputMaybe; + incomingAmount?: InputMaybe /** Additional metadata associated with the incoming payment. */ - metadata?: InputMaybe; + metadata?: InputMaybe /** Receiving wallet address URL */ - walletAddressUrl: Scalars['String']['input']; -}; + walletAddressUrl: Scalars['String']['input'] +} export type CreateReceiverResponse = { - __typename?: 'CreateReceiverResponse'; - receiver?: Maybe; -}; + __typename?: 'CreateReceiverResponse' + receiver?: Maybe +} export type CreateWalletAddressInput = { /** Additional properties associated with the [walletAddress]. */ - additionalProperties?: InputMaybe>; + additionalProperties?: InputMaybe> /** Asset of the wallet address */ - assetId: Scalars['String']['input']; + assetId: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Public name associated with the wallet address */ - publicName?: InputMaybe; + publicName?: InputMaybe /** Wallet Address URL */ - url: Scalars['String']['input']; -}; + url: Scalars['String']['input'] +} export type CreateWalletAddressKeyInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Public key */ - jwk: JwkInput; - walletAddressId: Scalars['String']['input']; -}; + jwk: JwkInput + walletAddressId: Scalars['String']['input'] +} export type CreateWalletAddressKeyMutationResponse = { - __typename?: 'CreateWalletAddressKeyMutationResponse'; - walletAddressKey?: Maybe; -}; + __typename?: 'CreateWalletAddressKeyMutationResponse' + walletAddressKey?: Maybe +} export type CreateWalletAddressMutationResponse = { - __typename?: 'CreateWalletAddressMutationResponse'; - walletAddress?: Maybe; -}; + __typename?: 'CreateWalletAddressMutationResponse' + walletAddress?: Maybe +} export type CreateWalletAddressWithdrawalInput = { /** The id of the withdrawal. */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** This is the interval in seconds after a pending transfer's created at which it may be posted or voided. Zero denotes a no timeout single-phase posted transfer. */ - timeoutSeconds: Scalars['BigInt']['input']; + timeoutSeconds: Scalars['BigInt']['input'] /** The id of the Open Payments wallet address to create the withdrawal for. */ - walletAddressId: Scalars['String']['input']; -}; + walletAddressId: Scalars['String']['input'] +} export enum Crv { Ed25519 = 'Ed25519' @@ -335,91 +347,91 @@ export enum Crv { export type DeleteAssetInput = { /** Asset id */ - id: Scalars['ID']['input']; + id: Scalars['ID']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; -}; + idempotencyKey?: InputMaybe +} export type DeleteAssetMutationResponse = { - __typename?: 'DeleteAssetMutationResponse'; - asset?: Maybe; -}; + __typename?: 'DeleteAssetMutationResponse' + asset?: Maybe +} export type DeletePeerInput = { - id: Scalars['ID']['input']; + id: Scalars['ID']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; -}; + idempotencyKey?: InputMaybe +} export type DeletePeerMutationResponse = { - __typename?: 'DeletePeerMutationResponse'; - success: Scalars['Boolean']['output']; -}; + __typename?: 'DeletePeerMutationResponse' + success: Scalars['Boolean']['output'] +} export type DepositAssetLiquidityInput = { /** Amount of liquidity to deposit. */ - amount: Scalars['BigInt']['input']; + amount: Scalars['BigInt']['input'] /** The id of the asset to deposit liquidity. */ - assetId: Scalars['String']['input']; + assetId: Scalars['String']['input'] /** The id of the transfer. */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; -}; + idempotencyKey: Scalars['String']['input'] +} export type DepositEventLiquidityInput = { /** The id of the event to deposit into. */ - eventId: Scalars['String']['input']; + eventId: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; -}; + idempotencyKey: Scalars['String']['input'] +} export type DepositOutgoingPaymentLiquidityInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the outgoing payment to deposit into. */ - outgoingPaymentId: Scalars['String']['input']; -}; + outgoingPaymentId: Scalars['String']['input'] +} export type DepositPeerLiquidityInput = { /** Amount of liquidity to deposit. */ - amount: Scalars['BigInt']['input']; + amount: Scalars['BigInt']['input'] /** The id of the transfer. */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the peer to deposit liquidity. */ - peerId: Scalars['String']['input']; -}; + peerId: Scalars['String']['input'] +} export type Fee = Model & { - __typename?: 'Fee'; + __typename?: 'Fee' /** Asset id associated with the fee */ - assetId: Scalars['ID']['output']; + assetId: Scalars['ID']['output'] /** Basis points fee. 1 basis point = 0.01%, 100 basis points = 1%, 10000 basis points = 100% */ - basisPoints: Scalars['Int']['output']; + basisPoints: Scalars['Int']['output'] /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Fixed fee */ - fixed: Scalars['BigInt']['output']; + fixed: Scalars['BigInt']['output'] /** Fee id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Type of fee (sending or receiving) */ - type: FeeType; -}; + type: FeeType +} export type FeeDetails = { /** Basis points fee. Should be between 0 and 10000 (inclusive). 1 basis point = 0.01%, 100 basis points = 1%, 10000 basis points = 100% */ - basisPoints: Scalars['Int']['input']; + basisPoints: Scalars['Int']['input'] /** A flat fee */ - fixed: Scalars['BigInt']['input']; -}; + fixed: Scalars['BigInt']['input'] +} export type FeeEdge = { - __typename?: 'FeeEdge'; - cursor: Scalars['String']['output']; - node: Fee; -}; + __typename?: 'FeeEdge' + cursor: Scalars['String']['output'] + node: Fee +} export enum FeeType { /** Receiver pays the fees */ @@ -429,88 +441,89 @@ export enum FeeType { } export type FeesConnection = { - __typename?: 'FeesConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'FeesConnection' + edges: Array + pageInfo: PageInfo +} export type FilterString = { - in: Array; -}; + in: Array +} export type Http = { - __typename?: 'Http'; + __typename?: 'Http' /** Outgoing connection details */ - outgoing: HttpOutgoing; -}; + outgoing: HttpOutgoing +} export type HttpIncomingInput = { /** Array of auth tokens accepted by this Rafiki instance */ - authTokens: Array; -}; + authTokens: Array +} export type HttpInput = { /** Incoming connection details */ - incoming?: InputMaybe; + incoming?: InputMaybe /** Outgoing connection details */ - outgoing: HttpOutgoingInput; -}; + outgoing: HttpOutgoingInput +} export type HttpOutgoing = { - __typename?: 'HttpOutgoing'; + __typename?: 'HttpOutgoing' /** Auth token to present at the peering Rafiki instance */ - authToken: Scalars['String']['output']; + authToken: Scalars['String']['output'] /** Peer's connection endpoint */ - endpoint: Scalars['String']['output']; -}; + endpoint: Scalars['String']['output'] +} export type HttpOutgoingInput = { /** Auth token to present at the peering Rafiki instance */ - authToken: Scalars['String']['input']; + authToken: Scalars['String']['input'] /** Peer's connection endpoint */ - endpoint: Scalars['String']['input']; -}; + endpoint: Scalars['String']['input'] +} -export type IncomingPayment = BasePayment & Model & { - __typename?: 'IncomingPayment'; - /** Information about the wallet address of the Open Payments client that created the incoming payment. */ - client?: Maybe; - /** Date-time of creation */ - createdAt: Scalars['String']['output']; - /** Date-time of expiry. After this time, the incoming payment will not accept further payments made to it. */ - expiresAt: Scalars['String']['output']; - /** Incoming Payment id */ - id: Scalars['ID']['output']; - /** The maximum amount that should be paid into the wallet address under this incoming payment. */ - incomingAmount?: Maybe; - /** Available liquidity */ - liquidity?: Maybe; - /** Additional metadata associated with the incoming payment. */ - metadata?: Maybe; - /** The total amount that has been paid into the wallet address under this incoming payment. */ - receivedAmount: Amount; - /** Incoming payment state */ - state: IncomingPaymentState; - /** Id of the wallet address under which this incoming payment was created. */ - walletAddressId: Scalars['ID']['output']; -}; +export type IncomingPayment = BasePayment & + Model & { + __typename?: 'IncomingPayment' + /** Information about the wallet address of the Open Payments client that created the incoming payment. */ + client?: Maybe + /** Date-time of creation */ + createdAt: Scalars['String']['output'] + /** Date-time of expiry. After this time, the incoming payment will not accept further payments made to it. */ + expiresAt: Scalars['String']['output'] + /** Incoming Payment id */ + id: Scalars['ID']['output'] + /** The maximum amount that should be paid into the wallet address under this incoming payment. */ + incomingAmount?: Maybe + /** Available liquidity */ + liquidity?: Maybe + /** Additional metadata associated with the incoming payment. */ + metadata?: Maybe + /** The total amount that has been paid into the wallet address under this incoming payment. */ + receivedAmount: Amount + /** Incoming payment state */ + state: IncomingPaymentState + /** Id of the wallet address under which this incoming payment was created. */ + walletAddressId: Scalars['ID']['output'] + } export type IncomingPaymentConnection = { - __typename?: 'IncomingPaymentConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'IncomingPaymentConnection' + edges: Array + pageInfo: PageInfo +} export type IncomingPaymentEdge = { - __typename?: 'IncomingPaymentEdge'; - cursor: Scalars['String']['output']; - node: IncomingPayment; -}; + __typename?: 'IncomingPaymentEdge' + cursor: Scalars['String']['output'] + node: IncomingPayment +} export type IncomingPaymentResponse = { - __typename?: 'IncomingPaymentResponse'; - payment?: Maybe; -}; + __typename?: 'IncomingPaymentResponse' + payment?: Maybe +} export enum IncomingPaymentState { /** The payment is either auto-completed once the received amount equals the expected `incomingAmount`, or it is completed manually via an API call. */ @@ -524,31 +537,31 @@ export enum IncomingPaymentState { } export type Jwk = { - __typename?: 'Jwk'; + __typename?: 'Jwk' /** Cryptographic algorithm family used with the key. The only allowed value is `EdDSA`. */ - alg: Alg; + alg: Alg /** Curve that the key pair is derived from. The only allowed value is `Ed25519`. */ - crv: Crv; + crv: Crv /** Key id */ - kid: Scalars['String']['output']; + kid: Scalars['String']['output'] /** Key type. The only allowed value is `OKP`. */ - kty: Kty; + kty: Kty /** Base64 url-encoded public key. */ - x: Scalars['String']['output']; -}; + x: Scalars['String']['output'] +} export type JwkInput = { /** Cryptographic algorithm family used with the key. The only allowed value is `EdDSA`. */ - alg: Alg; + alg: Alg /** Curve that the key pair is derived from. The only allowed value is `Ed25519`. */ - crv: Crv; + crv: Crv /** Key id */ - kid: Scalars['String']['input']; + kid: Scalars['String']['input'] /** Key type. The only allowed value is `OKP`. */ - kty: Kty; + kty: Kty /** Base64 url-encoded public key. */ - x: Scalars['String']['input']; -}; + x: Scalars['String']['input'] +} export enum Kty { Okp = 'OKP' @@ -570,288 +583,258 @@ export enum LiquidityError { } export type LiquidityMutationResponse = { - __typename?: 'LiquidityMutationResponse'; - success: Scalars['Boolean']['output']; -}; + __typename?: 'LiquidityMutationResponse' + success: Scalars['Boolean']['output'] +} export type Model = { - createdAt: Scalars['String']['output']; - id: Scalars['ID']['output']; -}; + createdAt: Scalars['String']['output'] + id: Scalars['ID']['output'] +} export type Mutation = { - __typename?: 'Mutation'; + __typename?: 'Mutation' /** Cancel Outgoing Payment */ - cancelOutgoingPayment: OutgoingPaymentResponse; + cancelOutgoingPayment: OutgoingPaymentResponse /** Create an asset */ - createAsset: AssetMutationResponse; + createAsset: AssetMutationResponse /** Withdraw asset liquidity */ - createAssetLiquidityWithdrawal?: Maybe; + createAssetLiquidityWithdrawal?: Maybe /** Create an internal Open Payments Incoming Payment. The receiver has a wallet address on this Rafiki instance. */ - createIncomingPayment: IncomingPaymentResponse; + createIncomingPayment: IncomingPaymentResponse /** Withdraw incoming payment liquidity */ - createIncomingPaymentWithdrawal?: Maybe; + createIncomingPaymentWithdrawal?: Maybe /** Create a peer using a URL */ - createOrUpdatePeerByUrl: CreateOrUpdatePeerByUrlMutationResponse; + createOrUpdatePeerByUrl: CreateOrUpdatePeerByUrlMutationResponse /** Create an Open Payments Outgoing Payment */ - createOutgoingPayment: OutgoingPaymentResponse; + createOutgoingPayment: OutgoingPaymentResponse /** Create an Open Payments Outgoing Payment from an incoming payment */ - createOutgoingPaymentFromIncomingPayment: OutgoingPaymentResponse; + createOutgoingPaymentFromIncomingPayment: OutgoingPaymentResponse /** Withdraw outgoing payment liquidity */ - createOutgoingPaymentWithdrawal?: Maybe; + createOutgoingPaymentWithdrawal?: Maybe /** Create a peer */ - createPeer: CreatePeerMutationResponse; + createPeer: CreatePeerMutationResponse /** Withdraw peer liquidity */ - createPeerLiquidityWithdrawal?: Maybe; + createPeerLiquidityWithdrawal?: Maybe /** Create an Open Payments Quote */ - createQuote: QuoteResponse; + createQuote: QuoteResponse /** Create an internal or external Open Payments Incoming Payment. The receiver has a wallet address on either this or another Open Payments resource server. */ - createReceiver: CreateReceiverResponse; + createReceiver: CreateReceiverResponse /** Create a wallet address */ - createWalletAddress: CreateWalletAddressMutationResponse; + createWalletAddress: CreateWalletAddressMutationResponse /** Add a public key to a wallet address that is used to verify Open Payments requests. */ - createWalletAddressKey?: Maybe; + createWalletAddressKey?: Maybe /** Withdraw liquidity from a wallet address received via Web Monetization. */ - createWalletAddressWithdrawal?: Maybe; + createWalletAddressWithdrawal?: Maybe /** Delete an asset */ - deleteAsset: DeleteAssetMutationResponse; + deleteAsset: DeleteAssetMutationResponse /** Delete a peer */ - deletePeer: DeletePeerMutationResponse; + deletePeer: DeletePeerMutationResponse /** Deposit asset liquidity */ - depositAssetLiquidity?: Maybe; + depositAssetLiquidity?: Maybe /** * Deposit webhook event liquidity * @deprecated Use `depositOutgoingPaymentLiquidity` */ - depositEventLiquidity?: Maybe; + depositEventLiquidity?: Maybe /** Deposit outgoing payment liquidity */ - depositOutgoingPaymentLiquidity?: Maybe; + depositOutgoingPaymentLiquidity?: Maybe /** Deposit peer liquidity */ - depositPeerLiquidity?: Maybe; + depositPeerLiquidity?: Maybe /** Post liquidity withdrawal. Withdrawals are two-phase commits and are committed via this mutation. */ - postLiquidityWithdrawal?: Maybe; + postLiquidityWithdrawal?: Maybe /** Revoke a public key associated with a wallet address. Open Payment requests using this key for request signatures will be denied going forward. */ - revokeWalletAddressKey?: Maybe; + revokeWalletAddressKey?: Maybe /** Set the fee on an asset */ - setFee: SetFeeResponse; + setFee: SetFeeResponse /** If automatic withdrawal of funds received via Web Monetization by the wallet address are disabled, this mutation can be used to trigger up to n withdrawal events. */ - triggerWalletAddressEvents: TriggerWalletAddressEventsMutationResponse; + triggerWalletAddressEvents: TriggerWalletAddressEventsMutationResponse /** Update an asset */ - updateAsset: AssetMutationResponse; + updateAsset: AssetMutationResponse /** Update a peer */ - updatePeer: UpdatePeerMutationResponse; + updatePeer: UpdatePeerMutationResponse /** Update a wallet address */ - updateWalletAddress: UpdateWalletAddressMutationResponse; + updateWalletAddress: UpdateWalletAddressMutationResponse /** Void liquidity withdrawal. Withdrawals are two-phase commits and are rolled back via this mutation. */ - voidLiquidityWithdrawal?: Maybe; + voidLiquidityWithdrawal?: Maybe /** * Withdraw webhook event liquidity * @deprecated Use `createOutgoingPaymentWithdrawal, createIncomingPaymentWithdrawal, or createWalletAddressWithdrawal` */ - withdrawEventLiquidity?: Maybe; -}; - + withdrawEventLiquidity?: Maybe +} export type MutationCancelOutgoingPaymentArgs = { - input: CancelOutgoingPaymentInput; -}; - + input: CancelOutgoingPaymentInput +} export type MutationCreateAssetArgs = { - input: CreateAssetInput; -}; - + input: CreateAssetInput +} export type MutationCreateAssetLiquidityWithdrawalArgs = { - input: CreateAssetLiquidityWithdrawalInput; -}; - + input: CreateAssetLiquidityWithdrawalInput +} export type MutationCreateIncomingPaymentArgs = { - input: CreateIncomingPaymentInput; -}; - + input: CreateIncomingPaymentInput +} export type MutationCreateIncomingPaymentWithdrawalArgs = { - input: CreateIncomingPaymentWithdrawalInput; -}; - + input: CreateIncomingPaymentWithdrawalInput +} export type MutationCreateOrUpdatePeerByUrlArgs = { - input: CreateOrUpdatePeerByUrlInput; -}; - + input: CreateOrUpdatePeerByUrlInput +} export type MutationCreateOutgoingPaymentArgs = { - input: CreateOutgoingPaymentInput; -}; - + input: CreateOutgoingPaymentInput +} export type MutationCreateOutgoingPaymentFromIncomingPaymentArgs = { - input: CreateOutgoingPaymentFromIncomingPaymentInput; -}; - + input: CreateOutgoingPaymentFromIncomingPaymentInput +} export type MutationCreateOutgoingPaymentWithdrawalArgs = { - input: CreateOutgoingPaymentWithdrawalInput; -}; - + input: CreateOutgoingPaymentWithdrawalInput +} export type MutationCreatePeerArgs = { - input: CreatePeerInput; -}; - + input: CreatePeerInput +} export type MutationCreatePeerLiquidityWithdrawalArgs = { - input: CreatePeerLiquidityWithdrawalInput; -}; - + input: CreatePeerLiquidityWithdrawalInput +} export type MutationCreateQuoteArgs = { - input: CreateQuoteInput; -}; - + input: CreateQuoteInput +} export type MutationCreateReceiverArgs = { - input: CreateReceiverInput; -}; - + input: CreateReceiverInput +} export type MutationCreateWalletAddressArgs = { - input: CreateWalletAddressInput; -}; - + input: CreateWalletAddressInput +} export type MutationCreateWalletAddressKeyArgs = { - input: CreateWalletAddressKeyInput; -}; - + input: CreateWalletAddressKeyInput +} export type MutationCreateWalletAddressWithdrawalArgs = { - input: CreateWalletAddressWithdrawalInput; -}; - + input: CreateWalletAddressWithdrawalInput +} export type MutationDeleteAssetArgs = { - input: DeleteAssetInput; -}; - + input: DeleteAssetInput +} export type MutationDeletePeerArgs = { - input: DeletePeerInput; -}; - + input: DeletePeerInput +} export type MutationDepositAssetLiquidityArgs = { - input: DepositAssetLiquidityInput; -}; - + input: DepositAssetLiquidityInput +} export type MutationDepositEventLiquidityArgs = { - input: DepositEventLiquidityInput; -}; - + input: DepositEventLiquidityInput +} export type MutationDepositOutgoingPaymentLiquidityArgs = { - input: DepositOutgoingPaymentLiquidityInput; -}; - + input: DepositOutgoingPaymentLiquidityInput +} export type MutationDepositPeerLiquidityArgs = { - input: DepositPeerLiquidityInput; -}; - + input: DepositPeerLiquidityInput +} export type MutationPostLiquidityWithdrawalArgs = { - input: PostLiquidityWithdrawalInput; -}; - + input: PostLiquidityWithdrawalInput +} export type MutationRevokeWalletAddressKeyArgs = { - input: RevokeWalletAddressKeyInput; -}; - + input: RevokeWalletAddressKeyInput +} export type MutationSetFeeArgs = { - input: SetFeeInput; -}; - + input: SetFeeInput +} export type MutationTriggerWalletAddressEventsArgs = { - input: TriggerWalletAddressEventsInput; -}; - + input: TriggerWalletAddressEventsInput +} export type MutationUpdateAssetArgs = { - input: UpdateAssetInput; -}; - + input: UpdateAssetInput +} export type MutationUpdatePeerArgs = { - input: UpdatePeerInput; -}; - + input: UpdatePeerInput +} export type MutationUpdateWalletAddressArgs = { - input: UpdateWalletAddressInput; -}; - + input: UpdateWalletAddressInput +} export type MutationVoidLiquidityWithdrawalArgs = { - input: VoidLiquidityWithdrawalInput; -}; - + input: VoidLiquidityWithdrawalInput +} export type MutationWithdrawEventLiquidityArgs = { - input: WithdrawEventLiquidityInput; -}; + input: WithdrawEventLiquidityInput +} -export type OutgoingPayment = BasePayment & Model & { - __typename?: 'OutgoingPayment'; - /** Information about the wallet address of the Open Payments client that created the outgoing payment. */ - client?: Maybe; - /** Date-time of creation */ - createdAt: Scalars['String']['output']; - /** Amount to send (fixed send) */ - debitAmount: Amount; - error?: Maybe; - /** Outgoing payment id */ - id: Scalars['ID']['output']; - /** Available liquidity */ - liquidity?: Maybe; - /** Additional metadata associated with the outgoing payment. */ - metadata?: Maybe; - /** Quote for this outgoing payment */ - quote?: Maybe; - /** Amount to receive (fixed receive) */ - receiveAmount: Amount; - /** Wallet address URL of the receiver */ - receiver: Scalars['String']['output']; - /** Amount already sent */ - sentAmount: Amount; - /** Outgoing payment state */ - state: OutgoingPaymentState; - stateAttempts: Scalars['Int']['output']; - /** Id of the wallet address under which this outgoing payment was created */ - walletAddressId: Scalars['ID']['output']; -}; +export type OutgoingPayment = BasePayment & + Model & { + __typename?: 'OutgoingPayment' + /** Information about the wallet address of the Open Payments client that created the outgoing payment. */ + client?: Maybe + /** Date-time of creation */ + createdAt: Scalars['String']['output'] + /** Amount to send (fixed send) */ + debitAmount: Amount + error?: Maybe + /** Outgoing payment id */ + id: Scalars['ID']['output'] + /** Available liquidity */ + liquidity?: Maybe + /** Additional metadata associated with the outgoing payment. */ + metadata?: Maybe + /** Quote for this outgoing payment */ + quote?: Maybe + /** Amount to receive (fixed receive) */ + receiveAmount: Amount + /** Wallet address URL of the receiver */ + receiver: Scalars['String']['output'] + /** Amount already sent */ + sentAmount: Amount + /** Outgoing payment state */ + state: OutgoingPaymentState + stateAttempts: Scalars['Int']['output'] + /** Id of the wallet address under which this outgoing payment was created */ + walletAddressId: Scalars['ID']['output'] + } export type OutgoingPaymentConnection = { - __typename?: 'OutgoingPaymentConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'OutgoingPaymentConnection' + edges: Array + pageInfo: PageInfo +} export type OutgoingPaymentEdge = { - __typename?: 'OutgoingPaymentEdge'; - cursor: Scalars['String']['output']; - node: OutgoingPayment; -}; + __typename?: 'OutgoingPaymentEdge' + cursor: Scalars['String']['output'] + node: OutgoingPayment +} export type OutgoingPaymentResponse = { - __typename?: 'OutgoingPaymentResponse'; - payment?: Maybe; -}; + __typename?: 'OutgoingPaymentResponse' + payment?: Maybe +} export enum OutgoingPaymentState { /** Payment cancelled */ @@ -867,53 +850,54 @@ export enum OutgoingPaymentState { } export type PageInfo = { - __typename?: 'PageInfo'; + __typename?: 'PageInfo' /** Paginating forwards: the cursor to continue. */ - endCursor?: Maybe; + endCursor?: Maybe /** Paginating forwards: Are there more pages? */ - hasNextPage: Scalars['Boolean']['output']; + hasNextPage: Scalars['Boolean']['output'] /** Paginating backwards: Are there more pages? */ - hasPreviousPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output'] /** Paginating backwards: the cursor to continue. */ - startCursor?: Maybe; -}; + startCursor?: Maybe +} -export type Payment = BasePayment & Model & { - __typename?: 'Payment'; - /** Information about the wallet address of the Open Payments client that created the payment. */ - client?: Maybe; - /** Date-time of creation */ - createdAt: Scalars['String']['output']; - /** Payment id */ - id: Scalars['ID']['output']; - /** Available liquidity */ - liquidity?: Maybe; - /** Additional metadata associated with the payment. */ - metadata?: Maybe; - /** Either the IncomingPaymentState or OutgoingPaymentState according to type */ - state: Scalars['String']['output']; - /** Type of payment */ - type: PaymentType; - /** Id of the wallet address under which this payment was created */ - walletAddressId: Scalars['ID']['output']; -}; +export type Payment = BasePayment & + Model & { + __typename?: 'Payment' + /** Information about the wallet address of the Open Payments client that created the payment. */ + client?: Maybe + /** Date-time of creation */ + createdAt: Scalars['String']['output'] + /** Payment id */ + id: Scalars['ID']['output'] + /** Available liquidity */ + liquidity?: Maybe + /** Additional metadata associated with the payment. */ + metadata?: Maybe + /** Either the IncomingPaymentState or OutgoingPaymentState according to type */ + state: Scalars['String']['output'] + /** Type of payment */ + type: PaymentType + /** Id of the wallet address under which this payment was created */ + walletAddressId: Scalars['ID']['output'] + } export type PaymentConnection = { - __typename?: 'PaymentConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'PaymentConnection' + edges: Array + pageInfo: PageInfo +} export type PaymentEdge = { - __typename?: 'PaymentEdge'; - cursor: Scalars['String']['output']; - node: Payment; -}; + __typename?: 'PaymentEdge' + cursor: Scalars['String']['output'] + node: Payment +} export type PaymentFilter = { - type?: InputMaybe; - walletAddressId?: InputMaybe; -}; + type?: InputMaybe + walletAddressId?: InputMaybe +} export enum PaymentType { Incoming = 'INCOMING', @@ -921,248 +905,236 @@ export enum PaymentType { } export type Peer = Model & { - __typename?: 'Peer'; + __typename?: 'Peer' /** Asset of peering relationship */ - asset: Asset; + asset: Asset /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Peering connection details */ - http: Http; + http: Http /** Peer id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Available liquidity */ - liquidity?: Maybe; + liquidity?: Maybe /** Account Servicing Entity will be notified via a webhook event if peer liquidity falls below this value */ - liquidityThreshold?: Maybe; + liquidityThreshold?: Maybe /** Maximum packet amount that the peer accepts */ - maxPacketAmount?: Maybe; + maxPacketAmount?: Maybe /** Peer's public name */ - name?: Maybe; + name?: Maybe /** Peer's ILP address */ - staticIlpAddress: Scalars['String']['output']; -}; + staticIlpAddress: Scalars['String']['output'] +} export type PeerEdge = { - __typename?: 'PeerEdge'; - cursor: Scalars['String']['output']; - node: Peer; -}; + __typename?: 'PeerEdge' + cursor: Scalars['String']['output'] + node: Peer +} export type PeersConnection = { - __typename?: 'PeersConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'PeersConnection' + edges: Array + pageInfo: PageInfo +} export type PostLiquidityWithdrawalInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the liquidity withdrawal to post. */ - withdrawalId: Scalars['String']['input']; -}; + withdrawalId: Scalars['String']['input'] +} export type Query = { - __typename?: 'Query'; + __typename?: 'Query' /** Fetch an asset */ - asset?: Maybe; + asset?: Maybe /** Fetch a page of assets. */ - assets: AssetsConnection; + assets: AssetsConnection /** Fetch an Open Payments incoming payment */ - incomingPayment?: Maybe; + incomingPayment?: Maybe /** Fetch an Open Payments outgoing payment */ - outgoingPayment?: Maybe; + outgoingPayment?: Maybe /** Fetch a page of combined payments */ - payments: PaymentConnection; + payments: PaymentConnection /** Fetch a peer */ - peer?: Maybe; + peer?: Maybe /** Fetch a page of peers. */ - peers: PeersConnection; + peers: PeersConnection /** Fetch an Open Payments quote */ - quote?: Maybe; + quote?: Maybe /** Get an local or remote Open Payments Incoming Payment. The receiver has a wallet address on either this or another Open Payments resource server. */ - receiver?: Maybe; + receiver?: Maybe /** Fetch a wallet address. */ - walletAddress?: Maybe; + walletAddress?: Maybe /** Fetch a page of wallet addresses. */ - walletAddresses: WalletAddressesConnection; + walletAddresses: WalletAddressesConnection /** Fetch a page of webhook events */ - webhookEvents: WebhookEventsConnection; -}; - + webhookEvents: WebhookEventsConnection +} export type QueryAssetArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryAssetsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type QueryIncomingPaymentArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryOutgoingPaymentArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryPaymentsArgs = { - after?: InputMaybe; - before?: InputMaybe; - filter?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + filter?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type QueryPeerArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryPeersArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type QueryQuoteArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryReceiverArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryWalletAddressArgs = { - id: Scalars['String']['input']; -}; - + id: Scalars['String']['input'] +} export type QueryWalletAddressesArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type QueryWebhookEventsArgs = { - after?: InputMaybe; - before?: InputMaybe; - filter?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; + after?: InputMaybe + before?: InputMaybe + filter?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type Quote = { - __typename?: 'Quote'; + __typename?: 'Quote' /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Amount to send (fixed send) */ - debitAmount: Amount; + debitAmount: Amount /** Date-time of expiration */ - expiresAt: Scalars['String']['output']; + expiresAt: Scalars['String']['output'] /** Upper bound of probed exchange rate */ - highEstimatedExchangeRate: Scalars['Float']['output']; + highEstimatedExchangeRate: Scalars['Float']['output'] /** Quote id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Lower bound of probed exchange rate */ - lowEstimatedExchangeRate: Scalars['Float']['output']; + lowEstimatedExchangeRate: Scalars['Float']['output'] /** Maximum value per packet allowed on the possible routes */ - maxPacketAmount: Scalars['BigInt']['output']; + maxPacketAmount: Scalars['BigInt']['output'] /** Aggregate exchange rate the payment is guaranteed to meet */ - minExchangeRate: Scalars['Float']['output']; + minExchangeRate: Scalars['Float']['output'] /** Amount to receive (fixed receive) */ - receiveAmount: Amount; + receiveAmount: Amount /** Wallet address URL of the receiver */ - receiver: Scalars['String']['output']; + receiver: Scalars['String']['output'] /** Id of the wallet address under which this quote was created */ - walletAddressId: Scalars['ID']['output']; -}; + walletAddressId: Scalars['ID']['output'] +} export type QuoteConnection = { - __typename?: 'QuoteConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'QuoteConnection' + edges: Array + pageInfo: PageInfo +} export type QuoteEdge = { - __typename?: 'QuoteEdge'; - cursor: Scalars['String']['output']; - node: Quote; -}; + __typename?: 'QuoteEdge' + cursor: Scalars['String']['output'] + node: Quote +} export type QuoteResponse = { - __typename?: 'QuoteResponse'; - quote?: Maybe; -}; + __typename?: 'QuoteResponse' + quote?: Maybe +} export type Receiver = { - __typename?: 'Receiver'; + __typename?: 'Receiver' /** Describes whether the incoming payment has completed receiving funds. */ - completed: Scalars['Boolean']['output']; + completed: Scalars['Boolean']['output'] /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Date-time of expiry. After this time, the incoming payment will accept further payments made to it. */ - expiresAt?: Maybe; + expiresAt?: Maybe /** Incoming payment URL */ - id: Scalars['String']['output']; + id: Scalars['String']['output'] /** The maximum amount that should be paid into the wallet address under this incoming payment. */ - incomingAmount?: Maybe; + incomingAmount?: Maybe /** Additional metadata associated with the incoming payment. */ - metadata?: Maybe; + metadata?: Maybe /** The total amount that has been paid into the wallet address under this incoming payment. */ - receivedAmount: Amount; + receivedAmount: Amount /** Date-time of last update */ - updatedAt: Scalars['String']['output']; + updatedAt: Scalars['String']['output'] /** Wallet address URL under which the incoming payment was created */ - walletAddressUrl: Scalars['String']['output']; -}; + walletAddressUrl: Scalars['String']['output'] +} export type RevokeWalletAddressKeyInput = { /** Internal id of key */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; -}; + idempotencyKey?: InputMaybe +} export type RevokeWalletAddressKeyMutationResponse = { - __typename?: 'RevokeWalletAddressKeyMutationResponse'; - walletAddressKey?: Maybe; -}; + __typename?: 'RevokeWalletAddressKeyMutationResponse' + walletAddressKey?: Maybe +} export type SetFeeInput = { /** Asset id to add the fee to */ - assetId: Scalars['ID']['input']; + assetId: Scalars['ID']['input'] /** Fee values */ - fee: FeeDetails; + fee: FeeDetails /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Type of fee (sending or receiving) */ - type: FeeType; -}; + type: FeeType +} export type SetFeeResponse = { - __typename?: 'SetFeeResponse'; - fee?: Maybe; -}; + __typename?: 'SetFeeResponse' + fee?: Maybe +} export enum SortOrder { /** Choose ascending order for results. */ @@ -1173,170 +1145,166 @@ export enum SortOrder { export type TriggerWalletAddressEventsInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Maximum number of events being triggered (n). */ - limit: Scalars['Int']['input']; -}; + limit: Scalars['Int']['input'] +} export type TriggerWalletAddressEventsMutationResponse = { - __typename?: 'TriggerWalletAddressEventsMutationResponse'; + __typename?: 'TriggerWalletAddressEventsMutationResponse' /** Number of events triggered */ - count?: Maybe; -}; + count?: Maybe +} export type UpdateAssetInput = { /** Asset id */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Account Servicing Entity will be notified via a webhook event if liquidity falls below this new value */ - liquidityThreshold?: InputMaybe; + liquidityThreshold?: InputMaybe /** New minimum amount of liquidity that can be withdrawn from the asset */ - withdrawalThreshold?: InputMaybe; -}; + withdrawalThreshold?: InputMaybe +} export type UpdatePeerInput = { /** New peering connection details */ - http?: InputMaybe; + http?: InputMaybe /** Peer id */ - id: Scalars['String']['input']; + id: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** Account Servicing Entity will be notified via a webhook event if peer liquidity falls below this new value */ - liquidityThreshold?: InputMaybe; + liquidityThreshold?: InputMaybe /** New maximum packet amount that the peer accepts */ - maxPacketAmount?: InputMaybe; + maxPacketAmount?: InputMaybe /** Peer's new public name */ - name?: InputMaybe; + name?: InputMaybe /** Peer's new ILP address */ - staticIlpAddress?: InputMaybe; -}; + staticIlpAddress?: InputMaybe +} export type UpdatePeerMutationResponse = { - __typename?: 'UpdatePeerMutationResponse'; - peer?: Maybe; -}; + __typename?: 'UpdatePeerMutationResponse' + peer?: Maybe +} export type UpdateWalletAddressInput = { /** List additional properties associated with this wallet address. */ - additionalProperties?: InputMaybe>; + additionalProperties?: InputMaybe> /** ID of wallet address to update */ - id: Scalars['ID']['input']; + id: Scalars['ID']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey?: InputMaybe; + idempotencyKey?: InputMaybe /** New public name for wallet address */ - publicName?: InputMaybe; + publicName?: InputMaybe /** New status to set the wallet address to */ - status?: InputMaybe; -}; + status?: InputMaybe +} export type UpdateWalletAddressMutationResponse = { - __typename?: 'UpdateWalletAddressMutationResponse'; - walletAddress?: Maybe; -}; + __typename?: 'UpdateWalletAddressMutationResponse' + walletAddress?: Maybe +} export type VoidLiquidityWithdrawalInput = { /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; + idempotencyKey: Scalars['String']['input'] /** The id of the liquidity withdrawal to void. */ - withdrawalId: Scalars['String']['input']; -}; + withdrawalId: Scalars['String']['input'] +} export type WalletAddress = Model & { - __typename?: 'WalletAddress'; + __typename?: 'WalletAddress' /** List additional properties associated with this wallet address. */ - additionalProperties?: Maybe>>; + additionalProperties?: Maybe>> /** Asset of the wallet address */ - asset: Asset; + asset: Asset /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Wallet address id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** List of incoming payments received by this wallet address */ - incomingPayments?: Maybe; + incomingPayments?: Maybe /** Available liquidity */ - liquidity?: Maybe; + liquidity?: Maybe /** List of outgoing payments sent from this wallet address */ - outgoingPayments?: Maybe; + outgoingPayments?: Maybe /** Public name associated with the wallet address */ - publicName?: Maybe; + publicName?: Maybe /** List of quotes created at this wallet address */ - quotes?: Maybe; + quotes?: Maybe /** Status of the wallet address */ - status: WalletAddressStatus; + status: WalletAddressStatus /** Wallet Address URL */ - url: Scalars['String']['output']; + url: Scalars['String']['output'] /** List of keys associated with this wallet address */ - walletAddressKeys?: Maybe; -}; - + walletAddressKeys?: Maybe +} export type WalletAddressIncomingPaymentsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type WalletAddressOutgoingPaymentsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type WalletAddressQuotesArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; - + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type WalletAddressWalletAddressKeysArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - sortOrder?: InputMaybe; -}; + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe + sortOrder?: InputMaybe +} export type WalletAddressEdge = { - __typename?: 'WalletAddressEdge'; - cursor: Scalars['String']['output']; - node: WalletAddress; -}; + __typename?: 'WalletAddressEdge' + cursor: Scalars['String']['output'] + node: WalletAddress +} export type WalletAddressKey = Model & { - __typename?: 'WalletAddressKey'; + __typename?: 'WalletAddressKey' /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Internal id of key */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Public key */ - jwk: Jwk; + jwk: Jwk /** Indicator whether the key has been revoked */ - revoked: Scalars['Boolean']['output']; + revoked: Scalars['Boolean']['output'] /** Id of the wallet address to which this key belongs to */ - walletAddressId: Scalars['ID']['output']; -}; + walletAddressId: Scalars['ID']['output'] +} export type WalletAddressKeyConnection = { - __typename?: 'WalletAddressKeyConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'WalletAddressKeyConnection' + edges: Array + pageInfo: PageInfo +} export type WalletAddressKeyEdge = { - __typename?: 'WalletAddressKeyEdge'; - cursor: Scalars['String']['output']; - node: WalletAddressKey; -}; + __typename?: 'WalletAddressKeyEdge' + cursor: Scalars['String']['output'] + node: WalletAddressKey +} export enum WalletAddressStatus { /** Default status */ @@ -1346,167 +1314,451 @@ export enum WalletAddressStatus { } export type WalletAddressWithdrawal = { - __typename?: 'WalletAddressWithdrawal'; + __typename?: 'WalletAddressWithdrawal' /** Amount to withdraw */ - amount: Scalars['BigInt']['output']; + amount: Scalars['BigInt']['output'] /** Withdrawal Id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Wallet address details */ - walletAddress: WalletAddress; -}; + walletAddress: WalletAddress +} export type WalletAddressWithdrawalMutationResponse = { - __typename?: 'WalletAddressWithdrawalMutationResponse'; - withdrawal?: Maybe; -}; + __typename?: 'WalletAddressWithdrawalMutationResponse' + withdrawal?: Maybe +} export type WalletAddressesConnection = { - __typename?: 'WalletAddressesConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'WalletAddressesConnection' + edges: Array + pageInfo: PageInfo +} export type WebhookEvent = Model & { - __typename?: 'WebhookEvent'; + __typename?: 'WebhookEvent' /** Date-time of creation */ - createdAt: Scalars['String']['output']; + createdAt: Scalars['String']['output'] /** Stringified JSON data */ - data: Scalars['JSONObject']['output']; + data: Scalars['JSONObject']['output'] /** Event id */ - id: Scalars['ID']['output']; + id: Scalars['ID']['output'] /** Type of event */ - type: Scalars['String']['output']; -}; + type: Scalars['String']['output'] +} export type WebhookEventFilter = { - type?: InputMaybe; -}; + type?: InputMaybe +} export type WebhookEventsConnection = { - __typename?: 'WebhookEventsConnection'; - edges: Array; - pageInfo: PageInfo; -}; + __typename?: 'WebhookEventsConnection' + edges: Array + pageInfo: PageInfo +} export type WebhookEventsEdge = { - __typename?: 'WebhookEventsEdge'; - cursor: Scalars['String']['output']; - node: WebhookEvent; -}; + __typename?: 'WebhookEventsEdge' + cursor: Scalars['String']['output'] + node: WebhookEvent +} export type WithdrawEventLiquidityInput = { /** The id of the event to withdraw from. */ - eventId: Scalars['String']['input']; + eventId: Scalars['String']['input'] /** Unique key to ensure duplicate or retried requests are processed only once. See [idempotence](https://en.wikipedia.org/wiki/Idempotence) */ - idempotencyKey: Scalars['String']['input']; -}; + idempotencyKey: Scalars['String']['input'] +} export type CreateAssetMutationVariables = Exact<{ - input: CreateAssetInput; -}>; - - -export type CreateAssetMutation = { __typename?: 'Mutation', createAsset: { __typename?: 'AssetMutationResponse', asset?: { __typename?: 'Asset', id: string, code: string, scale: number } | null } }; + input: CreateAssetInput +}> + +export type CreateAssetMutation = { + __typename?: 'Mutation' + createAsset: { + __typename?: 'AssetMutationResponse' + asset?: { + __typename?: 'Asset' + id: string + code: string + scale: number + } | null + } +} export type GetAssetsQueryVariables = Exact<{ - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; -}>; - - -export type GetAssetsQuery = { __typename?: 'Query', assets: { __typename?: 'AssetsConnection', edges: Array<{ __typename?: 'AssetEdge', cursor: string, node: { __typename?: 'Asset', code: string, createdAt: string, id: string, scale: number, withdrawalThreshold?: bigint | null } }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null } } }; + after?: InputMaybe + before?: InputMaybe + first?: InputMaybe + last?: InputMaybe +}> + +export type GetAssetsQuery = { + __typename?: 'Query' + assets: { + __typename?: 'AssetsConnection' + edges: Array<{ + __typename?: 'AssetEdge' + cursor: string + node: { + __typename?: 'Asset' + code: string + createdAt: string + id: string + scale: number + withdrawalThreshold?: bigint | null + } + }> + pageInfo: { + __typename?: 'PageInfo' + endCursor?: string | null + hasNextPage: boolean + hasPreviousPage: boolean + startCursor?: string | null + } + } +} export type GetAssetQueryVariables = Exact<{ - id: Scalars['String']['input']; -}>; - - -export type GetAssetQuery = { __typename?: 'Query', asset?: { __typename?: 'Asset', code: string, createdAt: string, id: string, scale: number, withdrawalThreshold?: bigint | null } | null }; + id: Scalars['String']['input'] +}> + +export type GetAssetQuery = { + __typename?: 'Query' + asset?: { + __typename?: 'Asset' + code: string + createdAt: string + id: string + scale: number + withdrawalThreshold?: bigint | null + } | null +} export type CreateIncomingPaymentMutationVariables = Exact<{ - input: CreateIncomingPaymentInput; -}>; - - -export type CreateIncomingPaymentMutation = { __typename?: 'Mutation', createIncomingPayment: { __typename?: 'IncomingPaymentResponse', payment?: { __typename?: 'IncomingPayment', createdAt: string, metadata?: any | null, expiresAt: string, id: string, walletAddressId: string, state: IncomingPaymentState, incomingAmount?: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } | null, receivedAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } } | null } }; + input: CreateIncomingPaymentInput +}> + +export type CreateIncomingPaymentMutation = { + __typename?: 'Mutation' + createIncomingPayment: { + __typename?: 'IncomingPaymentResponse' + payment?: { + __typename?: 'IncomingPayment' + createdAt: string + metadata?: any | null + expiresAt: string + id: string + walletAddressId: string + state: IncomingPaymentState + incomingAmount?: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } | null + receivedAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + } | null + } +} export type WithdrawLiquidityMutationVariables = Exact<{ - eventId: Scalars['String']['input']; - idempotencyKey: Scalars['String']['input']; -}>; - - -export type WithdrawLiquidityMutation = { __typename?: 'Mutation', withdrawEventLiquidity?: { __typename?: 'LiquidityMutationResponse', success: boolean } | null }; + eventId: Scalars['String']['input'] + idempotencyKey: Scalars['String']['input'] +}> + +export type WithdrawLiquidityMutation = { + __typename?: 'Mutation' + withdrawEventLiquidity?: { + __typename?: 'LiquidityMutationResponse' + success: boolean + } | null +} export type DepositLiquidityMutationVariables = Exact<{ - eventId: Scalars['String']['input']; - idempotencyKey: Scalars['String']['input']; -}>; - - -export type DepositLiquidityMutation = { __typename?: 'Mutation', depositEventLiquidity?: { __typename?: 'LiquidityMutationResponse', success: boolean } | null }; + eventId: Scalars['String']['input'] + idempotencyKey: Scalars['String']['input'] +}> + +export type DepositLiquidityMutation = { + __typename?: 'Mutation' + depositEventLiquidity?: { + __typename?: 'LiquidityMutationResponse' + success: boolean + } | null +} export type CreateOutgoingPaymentMutationVariables = Exact<{ - input: CreateOutgoingPaymentInput; -}>; - - -export type CreateOutgoingPaymentMutation = { __typename?: 'Mutation', createOutgoingPayment: { __typename?: 'OutgoingPaymentResponse', payment?: { __typename?: 'OutgoingPayment', createdAt: string, metadata?: any | null, error?: string | null, id: string, walletAddressId: string, receiver: string, state: OutgoingPaymentState, stateAttempts: number, quote?: { __typename?: 'Quote', createdAt: string, expiresAt: string, highEstimatedExchangeRate: number, id: string, lowEstimatedExchangeRate: number, maxPacketAmount: bigint, minExchangeRate: number, walletAddressId: string, receiver: string, receiveAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint }, debitAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } } | null, receiveAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint }, debitAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint }, sentAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } } | null } }; + input: CreateOutgoingPaymentInput +}> + +export type CreateOutgoingPaymentMutation = { + __typename?: 'Mutation' + createOutgoingPayment: { + __typename?: 'OutgoingPaymentResponse' + payment?: { + __typename?: 'OutgoingPayment' + createdAt: string + metadata?: any | null + error?: string | null + id: string + walletAddressId: string + receiver: string + state: OutgoingPaymentState + stateAttempts: number + quote?: { + __typename?: 'Quote' + createdAt: string + expiresAt: string + highEstimatedExchangeRate: number + id: string + lowEstimatedExchangeRate: number + maxPacketAmount: bigint + minExchangeRate: number + walletAddressId: string + receiver: string + receiveAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + debitAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + } | null + receiveAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + debitAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + sentAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + } | null + } +} export type CreateQuoteMutationVariables = Exact<{ - input: CreateQuoteInput; -}>; - - -export type CreateQuoteMutation = { __typename?: 'Mutation', createQuote: { __typename?: 'QuoteResponse', quote?: { __typename?: 'Quote', createdAt: string, expiresAt: string, highEstimatedExchangeRate: number, id: string, lowEstimatedExchangeRate: number, maxPacketAmount: bigint, minExchangeRate: number, walletAddressId: string, receiver: string, receiveAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint }, debitAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } } | null } }; + input: CreateQuoteInput +}> + +export type CreateQuoteMutation = { + __typename?: 'Mutation' + createQuote: { + __typename?: 'QuoteResponse' + quote?: { + __typename?: 'Quote' + createdAt: string + expiresAt: string + highEstimatedExchangeRate: number + id: string + lowEstimatedExchangeRate: number + maxPacketAmount: bigint + minExchangeRate: number + walletAddressId: string + receiver: string + receiveAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + debitAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + } | null + } +} export type GetQuoteQueryVariables = Exact<{ - quoteId: Scalars['String']['input']; -}>; - - -export type GetQuoteQuery = { __typename?: 'Query', quote?: { __typename?: 'Quote', id: string, walletAddressId: string, receiver: string, maxPacketAmount: bigint, minExchangeRate: number, lowEstimatedExchangeRate: number, highEstimatedExchangeRate: number, createdAt: string, expiresAt: string, debitAmount: { __typename?: 'Amount', value: bigint, assetCode: string, assetScale: number }, receiveAmount: { __typename?: 'Amount', value: bigint, assetCode: string, assetScale: number } } | null }; + quoteId: Scalars['String']['input'] +}> + +export type GetQuoteQuery = { + __typename?: 'Query' + quote?: { + __typename?: 'Quote' + id: string + walletAddressId: string + receiver: string + maxPacketAmount: bigint + minExchangeRate: number + lowEstimatedExchangeRate: number + highEstimatedExchangeRate: number + createdAt: string + expiresAt: string + debitAmount: { + __typename?: 'Amount' + value: bigint + assetCode: string + assetScale: number + } + receiveAmount: { + __typename?: 'Amount' + value: bigint + assetCode: string + assetScale: number + } + } | null +} export type CreateReceiverMutationVariables = Exact<{ - input: CreateReceiverInput; -}>; - - -export type CreateReceiverMutation = { __typename?: 'Mutation', createReceiver: { __typename?: 'CreateReceiverResponse', receiver?: { __typename?: 'Receiver', createdAt: string, metadata?: any | null, expiresAt?: string | null, id: string, walletAddressUrl: string, incomingAmount?: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } | null, receivedAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } } | null } }; + input: CreateReceiverInput +}> + +export type CreateReceiverMutation = { + __typename?: 'Mutation' + createReceiver: { + __typename?: 'CreateReceiverResponse' + receiver?: { + __typename?: 'Receiver' + createdAt: string + metadata?: any | null + expiresAt?: string | null + id: string + walletAddressUrl: string + incomingAmount?: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } | null + receivedAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + } | null + } +} export type GetReceiverQueryVariables = Exact<{ - id: Scalars['String']['input']; -}>; - - -export type GetReceiverQuery = { __typename?: 'Query', receiver?: { __typename?: 'Receiver', completed: boolean, createdAt: string, expiresAt?: string | null, metadata?: any | null, id: string, walletAddressUrl: string, updatedAt: string, incomingAmount?: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } | null, receivedAmount: { __typename?: 'Amount', assetCode: string, assetScale: number, value: bigint } } | null }; + id: Scalars['String']['input'] +}> + +export type GetReceiverQuery = { + __typename?: 'Query' + receiver?: { + __typename?: 'Receiver' + completed: boolean + createdAt: string + expiresAt?: string | null + metadata?: any | null + id: string + walletAddressUrl: string + updatedAt: string + incomingAmount?: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } | null + receivedAmount: { + __typename?: 'Amount' + assetCode: string + assetScale: number + value: bigint + } + } | null +} export type CreateWalletAddressKeyMutationVariables = Exact<{ - input: CreateWalletAddressKeyInput; -}>; - - -export type CreateWalletAddressKeyMutation = { __typename?: 'Mutation', createWalletAddressKey?: { __typename?: 'CreateWalletAddressKeyMutationResponse', walletAddressKey?: { __typename?: 'WalletAddressKey', id: string, walletAddressId: string, revoked: boolean, createdAt: string, jwk: { __typename?: 'Jwk', alg: Alg, crv: Crv, kid: string, kty: Kty, x: string } } | null } | null }; + input: CreateWalletAddressKeyInput +}> + +export type CreateWalletAddressKeyMutation = { + __typename?: 'Mutation' + createWalletAddressKey?: { + __typename?: 'CreateWalletAddressKeyMutationResponse' + walletAddressKey?: { + __typename?: 'WalletAddressKey' + id: string + walletAddressId: string + revoked: boolean + createdAt: string + jwk: { + __typename?: 'Jwk' + alg: Alg + crv: Crv + kid: string + kty: Kty + x: string + } + } | null + } | null +} export type RevokeWalletAddressKeyMutationVariables = Exact<{ - input: RevokeWalletAddressKeyInput; -}>; - - -export type RevokeWalletAddressKeyMutation = { __typename?: 'Mutation', revokeWalletAddressKey?: { __typename?: 'RevokeWalletAddressKeyMutationResponse', walletAddressKey?: { __typename?: 'WalletAddressKey', id: string, revoked: boolean, walletAddressId: string, createdAt: string } | null } | null }; + input: RevokeWalletAddressKeyInput +}> + +export type RevokeWalletAddressKeyMutation = { + __typename?: 'Mutation' + revokeWalletAddressKey?: { + __typename?: 'RevokeWalletAddressKeyMutationResponse' + walletAddressKey?: { + __typename?: 'WalletAddressKey' + id: string + revoked: boolean + walletAddressId: string + createdAt: string + } | null + } | null +} export type CreateWalletAddressMutationVariables = Exact<{ - input: CreateWalletAddressInput; -}>; - - -export type CreateWalletAddressMutation = { __typename?: 'Mutation', createWalletAddress: { __typename?: 'CreateWalletAddressMutationResponse', walletAddress?: { __typename?: 'WalletAddress', id: string, url: string, publicName?: string | null } | null } }; + input: CreateWalletAddressInput +}> + +export type CreateWalletAddressMutation = { + __typename?: 'Mutation' + createWalletAddress: { + __typename?: 'CreateWalletAddressMutationResponse' + walletAddress?: { + __typename?: 'WalletAddress' + id: string + url: string + publicName?: string | null + } | null + } +} export type UpdateWalletAddressMutationVariables = Exact<{ - input: UpdateWalletAddressInput; -}>; - - -export type UpdateWalletAddressMutation = { __typename?: 'Mutation', updateWalletAddress: { __typename?: 'UpdateWalletAddressMutationResponse', walletAddress?: { __typename?: 'WalletAddress', id: string, url: string, publicName?: string | null } | null } }; + input: UpdateWalletAddressInput +}> + +export type UpdateWalletAddressMutation = { + __typename?: 'Mutation' + updateWalletAddress: { + __typename?: 'UpdateWalletAddressMutationResponse' + walletAddress?: { + __typename?: 'WalletAddress' + id: string + url: string + publicName?: string | null + } | null + } +} diff --git a/packages/wallet/backend/src/rafiki/service.ts b/packages/wallet/backend/src/rafiki/service.ts index b8b621c49..004308290 100644 --- a/packages/wallet/backend/src/rafiki/service.ts +++ b/packages/wallet/backend/src/rafiki/service.ts @@ -8,9 +8,7 @@ import { UserService } from '@/user/service' import { SocketService } from '@/socket/service' import { NodeCacheInstance } from '@/utils/helpers' import { WalletAddressService } from '@/walletAddress/service' -import { WMTransactionService } from '@/webMonetization/transaction/service' import { Account } from '@/account/model' -import { WMTransaction } from '@/webMonetization/transaction/model' import MessageType from '@/socket/messageType' import { BadRequest } from '@shared/backend' @@ -84,8 +82,7 @@ export class RafikiService implements IRafikiService { private logger: Logger, private rafikiClient: RafikiClient, private transactionService: TransactionService, - private walletAddressService: WalletAddressService, - private wmTransactionService: WMTransactionService + private walletAddressService: WalletAddressService ) {} public async onWebHook(wh: WebHook): Promise { @@ -167,27 +164,20 @@ export class RafikiService implements IRafikiService { return amount } - private amountToNumber(amount: Amount): number { - return +(Number(amount.value) * 10 ** -amount.assetScale).toFixed( - amount.assetScale - ) + private amountToNumber( + amount: Amount, + toAssetScale: number = amount.assetScale + ): number { + const factor = 10 ** toAssetScale + const scaledValue = Number(amount.value) * 10 ** -amount.assetScale + const truncatedValue = Math.floor(scaledValue * factor) / factor + return truncatedValue } private async handleIncomingPaymentCompleted(wh: WebHook) { const walletAddress = await this.getWalletAddress(wh) const amount = this.getAmountFromWebHook(wh) - if (walletAddress.isWM) { - await this.rafikiClient.withdrawLiqudity(wh.id) - - await this.wmTransactionService.updateTransaction( - { paymentId: wh.data.id }, - { status: 'COMPLETED', value: amount.value } - ) - - return - } - const receiverWalletId = await this.getRapydWalletId(walletAddress) if (!this.validateAmount(amount, wh.type)) { @@ -203,7 +193,7 @@ export class RafikiService implements IRafikiService { } const transferResult = await this.rapydClient.transferLiquidity({ - amount: this.amountToNumber(amount), + amount: this.amountToNumber(amount, 2), currency: amount.assetCode, destination_ewallet: receiverWalletId, source_ewallet: this.env.RAPYD_SETTLEMENT_EWALLET @@ -236,7 +226,8 @@ export class RafikiService implements IRafikiService { this.logger.info( `Succesfully transfered ${this.amountToNumber( - amount + amount, + 2 )} from settlement account ${ this.env.RAPYD_SETTLEMENT_EWALLET } into ${receiverWalletId} ` @@ -246,12 +237,6 @@ export class RafikiService implements IRafikiService { private async handleIncomingPaymentCreated(wh: WebHook) { const walletAddress = await this.getWalletAddress(wh) - if (walletAddress.isWM) { - await this.wmTransactionService.createIncomingTransaction(wh.data) - - return - } - await this.transactionService.createIncomingTransaction( wh.data, walletAddress @@ -262,12 +247,6 @@ export class RafikiService implements IRafikiService { const walletAddress = await this.getWalletAddress(wh) const amount = this.getAmountFromWebHook(wh) - if (walletAddress.isWM) { - await this.rafikiClient.depositLiquidity(wh.id) - await this.wmTransactionService.createOutgoingTransaction(wh.data) - return - } - const rapydWalletId = await this.getRapydWalletId(walletAddress) if (!this.validateAmount(amount, wh.type)) { @@ -279,7 +258,7 @@ export class RafikiService implements IRafikiService { walletAddress ) const holdResult = await this.rapydClient.holdLiquidity({ - amount: this.amountToNumber(amount), + amount: this.amountToNumber(amount, 2), currency: amount.assetCode, ewallet: rapydWalletId }) @@ -295,7 +274,8 @@ export class RafikiService implements IRafikiService { this.logger.info( `Succesfully held ${this.amountToNumber( - amount + amount, + 2 )} in ${rapydWalletId} on ${EventType.OutgoingPaymentCreated}` ) } @@ -304,17 +284,6 @@ export class RafikiService implements IRafikiService { const walletAddress = await this.getWalletAddress(wh) const debitAmount = this.getAmountFromWebHook(wh) - if (walletAddress.isWM) { - await this.rafikiClient.withdrawLiqudity(wh.id) - - await this.wmTransactionService.updateTransaction( - { paymentId: wh.data.id }, - { status: 'COMPLETED', value: debitAmount.value } - ) - - return - } - const source_ewallet = await this.getRapydWalletId(walletAddress) if (!this.validateAmount(debitAmount, wh.type)) { @@ -322,13 +291,13 @@ export class RafikiService implements IRafikiService { } await this.rapydClient.releaseLiquidity({ - amount: this.amountToNumber(debitAmount), + amount: this.amountToNumber(debitAmount, 2), currency: debitAmount.assetCode, ewallet: source_ewallet }) await this.rapydClient.transferLiquidity({ - amount: this.amountToNumber(debitAmount), + amount: this.amountToNumber(debitAmount, 2), currency: debitAmount.assetCode, destination_ewallet: this.env.RAPYD_SETTLEMENT_EWALLET, source_ewallet @@ -359,7 +328,8 @@ export class RafikiService implements IRafikiService { this.logger.info( `Succesfully transfered ${this.amountToNumber( - debitAmount + debitAmount, + 2 )} from ${source_ewallet} to settlement account on ${ EventType.OutgoingPaymentCompleted }` @@ -376,24 +346,10 @@ export class RafikiService implements IRafikiService { const sentAmount = this.parseAmount(wh.data.sentAmount as AmountJSON) - if (walletAddress.isWM) { - await this.rafikiClient.withdrawLiqudity(wh.id) - - const update: Partial = sentAmount.value - ? { status: 'COMPLETED', value: sentAmount.value } - : { status: 'FAILED', value: 0n } - await this.wmTransactionService.updateTransaction( - { paymentId: wh.data.id }, - update - ) - - return - } - const source_ewallet = await this.getRapydWalletId(walletAddress) const releaseResult = await this.rapydClient.releaseLiquidity({ - amount: this.amountToNumber(debitAmount), + amount: this.amountToNumber(debitAmount, 2), currency: debitAmount.assetCode, ewallet: source_ewallet }) @@ -401,7 +357,8 @@ export class RafikiService implements IRafikiService { if (releaseResult.status?.status !== 'SUCCESS') { throw new Error( `Unable to release amount ${this.amountToNumber( - debitAmount + debitAmount, + 2 )} from ${source_ewallet} on ${ EventType.OutgoingPaymentFailed } error message: ${releaseResult.status?.message || 'unknown'}` @@ -419,7 +376,7 @@ export class RafikiService implements IRafikiService { //* transfer eventual already sent money to the settlement account const transferResult = await this.rapydClient.transferLiquidity({ - amount: this.amountToNumber(sentAmount), + amount: this.amountToNumber(sentAmount, 2), currency: sentAmount.assetCode, destination_ewallet: this.env.RAPYD_SETTLEMENT_EWALLET, source_ewallet diff --git a/packages/wallet/backend/src/rapyd/controller.ts b/packages/wallet/backend/src/rapyd/controller.ts index 2a4f5bffb..7e52be218 100644 --- a/packages/wallet/backend/src/rapyd/controller.ts +++ b/packages/wallet/backend/src/rapyd/controller.ts @@ -96,8 +96,7 @@ export class RapydController implements IRapydController { accountId: defaultAccount.id, walletAddressName, publicName: 'Default Payment Pointer', - userId: id, - isWM: false + userId: id }) } diff --git a/packages/wallet/backend/src/transaction/service.ts b/packages/wallet/backend/src/transaction/service.ts index 63ea8a6a8..983a77fcb 100644 --- a/packages/wallet/backend/src/transaction/service.ts +++ b/packages/wallet/backend/src/transaction/service.ts @@ -1,5 +1,10 @@ -import { Transaction } from './model' -import { OrderByDirection, Page, PartialModelObject } from 'objection' +import { Transaction, TransactionType } from './model' +import { + OrderByDirection, + Page, + PartialModelObject, + TransactionOrKnex +} from 'objection' import { AccountService } from '@/account/service' import { Logger } from 'winston' import { PaginationQueryParams } from '@/shared/types' @@ -164,4 +169,30 @@ export class TransactionService implements ITransactionService { description: params.metadata?.description }) } + + async sumByWalletAddressIdSince( + walletAddressId: string, + type: TransactionType, + since: Date, + trx?: TransactionOrKnex + ) { + const transactions = await Transaction.query(trx) + .where({ + walletAddressId, + type, + status: 'COMPLETED' + }) + .andWhere('createdAt', '>', since) + .andWhereNot('description', 'Asset scale 9 imbalance') + + const ids = transactions.map(({ id }) => id) + const sumResult = (await Transaction.query(trx) + .whereIn('id', ids) + .sum('value')) as unknown as [{ sum: bigint }] + + return { + ids, + sum: sumResult[0].sum ?? 0n + } + } } diff --git a/packages/wallet/backend/src/user/service.ts b/packages/wallet/backend/src/user/service.ts index 03cf3be94..8406b4581 100644 --- a/packages/wallet/backend/src/user/service.ts +++ b/packages/wallet/backend/src/user/service.ts @@ -127,8 +127,12 @@ export class UserService implements IUserService { if (existingUser) return - const asset = await this.rafikiClient.getRafikiAsset('USD', 2) - if (!asset) await this.rafikiClient.createAsset('USD', 2) + const asset = await this.rafikiClient.getRafikiAsset( + 'USD', + this.env.MAX_ASSET_SCALE + ) + if (!asset) + await this.rafikiClient.createAsset('USD', this.env.MAX_ASSET_SCALE) const defaultWalletUser = this.env.DEFAULT_WALLET_ACCOUNT const defaultBoutiqueUser = this.env.DEFAULT_BOUTIQUE_ACCOUNT @@ -149,16 +153,14 @@ export class UserService implements IUserService { accountId: walletInfo.defaultAccount.id, walletAddressName: typedArray[0].toString(16), publicName: 'Default Payment Pointer', - userId: walletInfo.createdUser.id, - isWM: false + userId: walletInfo.createdUser.id }) const boutiqueWallet = await this.walletAddressService.create({ accountId: boutiqueInfo.defaultAccount.id, walletAddressName: 'boutique', publicName: 'Rafiki Boutique', - userId: boutiqueInfo.createdUser.id, - isWM: false + userId: boutiqueInfo.createdUser.id }) await this.walletAddressKeyService.registerKey({ diff --git a/packages/wallet/backend/src/walletAddress/controller.ts b/packages/wallet/backend/src/walletAddress/controller.ts index 47faebe5b..314e7c53b 100644 --- a/packages/wallet/backend/src/walletAddress/controller.ts +++ b/packages/wallet/backend/src/walletAddress/controller.ts @@ -8,12 +8,11 @@ import { updateWalletAddressSchema } from './validation' import { Controller, toSuccessResponse } from '@shared/backend' -import { ListWalletAddressesResponse } from '@wallet/shared/src' import { WalletAddressOP, WalletAddressResponse } from '@wallet/shared' interface IWalletAddressController { create: Controller - list: Controller + list: Controller getById: Controller softDelete: Controller } @@ -30,15 +29,14 @@ export class WalletAddressController implements IWalletAddressController { const userId = req.session.user.id const { accountId } = req.params const { - body: { walletAddressName, publicName, isWM } + body: { walletAddressName, publicName } } = await validate(walletAddressSchema, req) const walletAddress = await this.walletAddressService.create({ userId, accountId, walletAddressName, - publicName, - isWM + publicName }) res.status(200).json(toSuccessResponse(walletAddress)) } catch (e) { @@ -48,7 +46,7 @@ export class WalletAddressController implements IWalletAddressController { list = async ( req: Request, - res: CustomResponse, + res: CustomResponse, next: NextFunction ) => { const userId = req.session.user.id diff --git a/packages/wallet/backend/src/walletAddress/model.ts b/packages/wallet/backend/src/walletAddress/model.ts index 39a9bff52..4f0d20d59 100644 --- a/packages/wallet/backend/src/walletAddress/model.ts +++ b/packages/wallet/backend/src/walletAddress/model.ts @@ -3,7 +3,7 @@ import { Account } from '@/account/model' import { Transaction } from '@/transaction/model' import { WalletAddressKeys } from '@/walletAddressKeys/model' import { BaseModel } from '@shared/backend' -import { IWalletAddressResponse } from '@wallet/shared/src' +import { IWalletAddressResponse } from '@wallet/shared' export class WalletAddress extends BaseModel implements IWalletAddressResponse { static tableName = 'walletAddresses' @@ -12,7 +12,6 @@ export class WalletAddress extends BaseModel implements IWalletAddressResponse { readonly id!: string readonly url!: string readonly accountId!: string - isWM!: boolean assetCode!: string | null assetScale!: number | null incomingBalance!: bigint diff --git a/packages/wallet/backend/src/walletAddress/service.ts b/packages/wallet/backend/src/walletAddress/service.ts index 2020ad559..d4499bbf2 100644 --- a/packages/wallet/backend/src/walletAddress/service.ts +++ b/packages/wallet/backend/src/walletAddress/service.ts @@ -6,16 +6,15 @@ import axios from 'axios' import { getRandomValues } from 'crypto' import { Cache, RedisClient } from '@shared/backend' import { WalletAddress } from './model' -import { WMTransactionService } from '@/webMonetization/transaction/service' import { PartialModelObject, TransactionOrKnex, raw } from 'objection' import { RapydClient } from '@/rapyd/rapyd-client' import { TransactionType } from '@/transaction/model' import { Logger } from 'winston' import { TransactionService } from '@/transaction/service' -import { BadRequest, Conflict, NotFound } from '@shared/backend' +import { Conflict, NotFound } from '@shared/backend' import { WalletAddressOP } from '@wallet/shared' -interface HandleBalanceParams { +interface HandleImbalanceParams { type: TransactionType balance: bigint walletAddress: WalletAddress @@ -33,7 +32,6 @@ export interface CreateWalletAddressArgs { accountId: string walletAddressName: string publicName: string - isWM: boolean } export type GetWalletAddressArgs = { @@ -42,15 +40,10 @@ export type GetWalletAddressArgs = { userId?: string } -export type WalletAddressList = { - wmWalletAddresses: WalletAddress[] - walletAddresses: WalletAddress[] -} - interface IWalletAddressService { create: (params: CreateWalletAddressArgs) => Promise update: (args: UpdateWalletAddressArgs) => Promise - list: (userId: string, accountId: string) => Promise + list: (userId: string, accountId: string) => Promise getById: (args: GetWalletAddressArgs) => Promise softDelete: (userId: string, id: string) => Promise } @@ -76,8 +69,7 @@ export const createWalletAddressIfFalsy = async ({ userId, accountId, walletAddressName: getRandomValues(new Uint32Array(1))[0].toString(16), - publicName, - isWM: false + publicName }) return newWalletAddress @@ -90,12 +82,11 @@ export class WalletAddressService implements IWalletAddressService { private rafikiClient: RafikiClient, private env: Env, redisClient: RedisClient, - private wmTransactionService: WMTransactionService, private transactionService: TransactionService, private rapydClient: RapydClient, private logger: Logger ) { - this.cache = new Cache(redisClient, 'WMWalletAddresses') + this.cache = new Cache(redisClient, 'WalletAddresses') } async create(args: CreateWalletAddressArgs): Promise { @@ -127,26 +118,7 @@ export class WalletAddressService implements IWalletAddressService { ) } } else { - let webMonetizationAsset - if (args.isWM) { - // @TEMPORARY: Enable WM only for USD - if (account.assetCode !== 'USD') { - throw new BadRequest( - 'Web Monetization is enabled exclusively for USD.' - ) - } - - webMonetizationAsset = await this.rafikiClient.getRafikiAsset( - 'USD', - this.env.MAX_ASSET_SCALE - ) - - if (!webMonetizationAsset) { - throw new NotFound('Web monetization asset not found.') - } - } - - const assetId = webMonetizationAsset?.id || account.assetId + const assetId = account.assetId const rafikiWalletAddress = await this.rafikiClient.createRafikiWalletAddress( args.publicName, @@ -159,48 +131,31 @@ export class WalletAddressService implements IWalletAddressService { publicName: args.publicName, accountId: args.accountId, id: rafikiWalletAddress.id, - isWM: args.isWM, - assetCode: webMonetizationAsset?.code, - assetScale: webMonetizationAsset?.scale + assetCode: account.assetCode, + assetScale: this.env.MAX_ASSET_SCALE }) - args.isWM && - (await this.cache.set(walletAddress.id, walletAddress, { - expiry: 60 - })) + await this.cache.set(walletAddress.id, walletAddress, { + expiry: 60 + }) } return walletAddress } - async list(userId: string, accountId: string): Promise { + async list(userId: string, accountId: string): Promise { const account = await this.accountService.findAccountById(accountId, userId) const walletAddressesResult = await WalletAddress.query() .where('accountId', account.id) .where('active', true) - const result = walletAddressesResult.reduce( - (acc, pp) => { - if (pp.isWM) { - acc.wmWalletAddresses.push(pp) - } else { - acc.walletAddresses.push(pp) - } - return acc - }, - { - wmWalletAddresses: [] as WalletAddress[], - walletAddresses: [] as WalletAddress[] - } - ) - - return result + return walletAddressesResult } async listAll(userId: string): Promise { return WalletAddress.query() - .where({ isWM: false, active: true }) + .where({ active: true }) .joinRelated('account') .where({ 'account.userId': userId @@ -208,8 +163,8 @@ export class WalletAddressService implements IWalletAddressService { } async getById(args: GetWalletAddressArgs): Promise { - //* Cache only contains WalletAddresses with isWM = true const cacheHit = await this.cache.get(args.walletAddressId) + if (cacheHit) { //* TODO: reset ttl return cacheHit @@ -231,11 +186,9 @@ export class WalletAddressService implements IWalletAddressService { throw new NotFound() } - if (walletAddress.isWM) { - await this.cache.set(walletAddress.id, walletAddress, { - expiry: 60 - }) - } + await this.cache.set(walletAddress.id, walletAddress, { + expiry: 60 + }) return walletAddress } @@ -303,6 +256,16 @@ export class WalletAddressService implements IWalletAddressService { publicName }) ]) + + await this.cache.delete(walletAddressId) + const updatedWalletAddress = await walletAddress + .$query(trx) + .findById(walletAddressId) + updatedWalletAddress && + (await this.cache.set(walletAddressId, updatedWalletAddress, { + expiry: 60 + })) + await trx.commit() } catch (e) { await trx.rollback() @@ -324,7 +287,6 @@ export class WalletAddressService implements IWalletAddressService { } async findByIdWithoutValidation(id: string) { - //* Cache only contains WalletAddresses with isWM = true const cacheHit = await this.cache.get(id) if (cacheHit) { //* TODO: reset ttl @@ -339,17 +301,15 @@ export class WalletAddressService implements IWalletAddressService { throw new NotFound() } - if (walletAddress.isWM) { - await this.cache.set(walletAddress.id, walletAddress, { - expiry: 60 - }) - } + await this.cache.set(walletAddress.id, walletAddress, { + expiry: 60 + }) return walletAddress } - private async handleBalance( - { type, balance, walletAddress }: HandleBalanceParams, + private async handleImbalance( + { type, balance, walletAddress }: HandleImbalanceParams, trx: TransactionOrKnex ): Promise { if (!walletAddress.assetCode || !walletAddress.assetScale) { @@ -357,12 +317,10 @@ export class WalletAddressService implements IWalletAddressService { `Missing asset information for payment pointer "${walletAddress.url} (ID: ${walletAddress.id})"` ) } - const amount = Number( - ( - Number(balance * this.env.WM_THRESHOLD) * - 10 ** -walletAddress.assetScale - ).toPrecision(2) - ) + + const value = Number(balance) * 10 ** -walletAddress.assetScale + const factor = 10 ** this.env.BASE_ASSET_SCALE + const amount = Math.floor(value * factor) / factor if (!walletAddress.account.user.rapydWalletId) { throw new Error( @@ -387,6 +345,7 @@ export class WalletAddressService implements IWalletAddressService { if (transfer.status?.status !== 'SUCCESS') { if (type === 'OUTGOING') { + //TODO this might not be needed await walletAddress.$relatedQuery('account', trx).patch({ debt: raw('?? + ?', ['debt', amount]) }) @@ -405,10 +364,7 @@ export class WalletAddressService implements IWalletAddressService { 'incomingBalance' | 'outgoingBalance' > = type === 'OUTGOING' ? 'outgoingBalance' : 'incomingBalance' const updatePart: PartialModelObject = { - [updatedField]: raw('?? - ?', [ - updatedField, - this.env.WM_THRESHOLD * balance - ]) + [updatedField]: raw('?? - ?', [updatedField, balance]) } await Promise.all([ @@ -416,26 +372,29 @@ export class WalletAddressService implements IWalletAddressService { accountId: walletAddress.accountId, paymentId: transfer.data.id, assetCode: walletAddress.assetCode!, - value: BigInt(amount * 10 ** this.env.BASE_ASSET_SCALE), + value: BigInt( + Math.floor( + amount * 10 ** this.env.MAX_ASSET_SCALE - this.env.BASE_ASSET_SCALE + ) + ), type, status: 'COMPLETED', - description: 'Web Monetization' + description: 'Asset scale 9 imbalance' }), walletAddress.$query(trx).update(updatePart) ]) - this.logger.info( - `Proccesed WM transactions for payment pointer ${walletAddress.url}. Type: ${type} | Amount: ${amount}` + this.logger.debug( + `Proccesed asset scale 9 transactions for payment pointer ${walletAddress.url}. Type: ${type} | Amount: ${amount}` ) } - async processWMWalletAddresses(): Promise { + async keepBalancesSynced(lastProcessedTimestamp: Date): Promise { const trx = await WalletAddress.startTransaction() try { const walletAddresses = await WalletAddress.query(trx) .where({ - isWM: true, active: true }) .withGraphFetched('account.user') @@ -446,14 +405,16 @@ export class WalletAddressService implements IWalletAddressService { } const [incoming, outgoing] = await Promise.all([ - this.wmTransactionService.sumByWalletAddressId( + this.transactionService.sumByWalletAddressIdSince( walletAddress.id, 'INCOMING', + lastProcessedTimestamp, trx ), - this.wmTransactionService.sumByWalletAddressId( + this.transactionService.sumByWalletAddressIdSince( walletAddress.id, 'OUTGOING', + lastProcessedTimestamp, trx ) ]) @@ -461,22 +422,25 @@ export class WalletAddressService implements IWalletAddressService { const tmpWalletAddress = await walletAddress .$query(trx) .updateAndFetchById(walletAddress.id, { - incomingBalance: raw('?? + ?', ['incomingBalance', incoming.sum]), - outgoingBalance: raw('?? + ?', ['outgoingBalance', outgoing.sum]) + incomingBalance: raw('?? + ?', [ + 'incomingBalance', + BigInt(incoming.sum) % this.env.RAPYD_THRESHOLD + ]), + outgoingBalance: raw('?? + ?', [ + 'outgoingBalance', + BigInt(outgoing.sum) % this.env.RAPYD_THRESHOLD + ]) }) - await this.wmTransactionService.deleteByTransactionIds( - incoming.ids.concat(outgoing.ids), - trx - ) + const incomingBalance = tmpWalletAddress.incomingBalance + const outgoingBalance = tmpWalletAddress.outgoingBalance - const incomingBalance = - tmpWalletAddress.incomingBalance / this.env.WM_THRESHOLD - const outgoingBalance = - tmpWalletAddress.outgoingBalance / this.env.WM_THRESHOLD + this.logger.debug( + `Incoming balance: ${incomingBalance}. Outgoing balance: ${outgoingBalance}` + ) - if (incomingBalance > 0n) { - await this.handleBalance( + if (incomingBalance >= this.env.RAPYD_THRESHOLD) { + await this.handleImbalance( { balance: incomingBalance, walletAddress, @@ -486,8 +450,8 @@ export class WalletAddressService implements IWalletAddressService { ) } - if (outgoingBalance > 0n) { - await this.handleBalance( + if (outgoingBalance >= this.env.RAPYD_THRESHOLD) { + await this.handleImbalance( { balance: outgoingBalance, walletAddress, @@ -501,7 +465,7 @@ export class WalletAddressService implements IWalletAddressService { } catch (e) { this.logger.error(e) await trx.rollback() - throw new Error('Error while processing WM payment pointers.') + throw new Error('Error while processing payment pointers.') } } } diff --git a/packages/wallet/backend/src/walletAddress/validation.ts b/packages/wallet/backend/src/walletAddress/validation.ts index 85eeb0632..7c63933c4 100644 --- a/packages/wallet/backend/src/walletAddress/validation.ts +++ b/packages/wallet/backend/src/walletAddress/validation.ts @@ -44,8 +44,7 @@ export const walletAddressSchema = z.object({ publicName: z .string() .trim() - .min(3, { message: 'Public name must be at least 3 characters long' }), - isWM: z.boolean() + .min(3, { message: 'Public name must be at least 3 characters long' }) }) }) diff --git a/packages/wallet/backend/src/walletAddressKeys/controller.ts b/packages/wallet/backend/src/walletAddressKeys/controller.ts index b71e76a41..4d8b82527 100644 --- a/packages/wallet/backend/src/walletAddressKeys/controller.ts +++ b/packages/wallet/backend/src/walletAddressKeys/controller.ts @@ -7,7 +7,7 @@ import { uploadWalletAddressKey } from './validation' import { Controller, toSuccessResponse } from '@shared/backend' -import { WalletAddressKeyResponse } from '@wallet/shared/src/types/WalletAddressKey' +import { WalletAddressKeyResponse } from '@wallet/shared' interface IWalletAddressKeyController { registerKey: Controller diff --git a/packages/wallet/backend/src/walletAddressKeys/model.ts b/packages/wallet/backend/src/walletAddressKeys/model.ts index a202535ab..3f69e74cc 100644 --- a/packages/wallet/backend/src/walletAddressKeys/model.ts +++ b/packages/wallet/backend/src/walletAddressKeys/model.ts @@ -1,7 +1,7 @@ import { Model } from 'objection' import { WalletAddress } from '@/walletAddress/model' import { BaseModel } from '@shared/backend' -import { WalletAddressKeyResponse } from '@wallet/shared/src/types/WalletAddressKey' +import { WalletAddressKeyResponse } from '@wallet/shared' export class WalletAddressKeys extends BaseModel diff --git a/packages/wallet/backend/src/webMonetization/transaction/model.ts b/packages/wallet/backend/src/webMonetization/transaction/model.ts deleted file mode 100644 index 96ed7fbcf..000000000 --- a/packages/wallet/backend/src/webMonetization/transaction/model.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { TransactionBaseModel } from '@/transaction/model' -import { Model } from 'objection' -import { WalletAddress } from '@/walletAddress/model' - -export class WMTransaction extends TransactionBaseModel { - static tableName = 'wmTransactions' - - walletAddressId!: string - walletAddress!: WalletAddress - - static relationMappings = () => ({ - wmWalletAddress: { - relation: Model.BelongsToOneRelation, - modelClass: WalletAddress, - join: { - from: 'wmTransactions.walletAddressId', - to: 'walletAddresses.id' - } - } - }) -} diff --git a/packages/wallet/backend/src/webMonetization/transaction/service.ts b/packages/wallet/backend/src/webMonetization/transaction/service.ts deleted file mode 100644 index addf86740..000000000 --- a/packages/wallet/backend/src/webMonetization/transaction/service.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { WMTransaction } from './model' -import { PartialModelObject, TransactionOrKnex } from 'objection' -import { Logger } from 'winston' -import { - IncomingPayment, - OutgoingPayment -} from '@/rafiki/backend/generated/graphql' -import { TransactionType } from '@/transaction/model' -import { addMinutes } from 'date-fns' - -export interface IWMTransactionService {} - -export class WMTransactionService implements IWMTransactionService { - constructor(private logger: Logger) {} - - async updateTransaction( - where: PartialModelObject, - update: PartialModelObject - ): Promise { - try { - this.logger.info(`Updating transaction with: ${JSON.stringify(update)}`) - await WMTransaction.query().where(where).update(update) - } catch (e) { - this.logger.error(`Update transaction error:`, e) - } - } - async createIncomingTransaction(params: IncomingPayment) { - return WMTransaction.query().insert({ - walletAddressId: params.walletAddressId, - paymentId: params.id, - expiresAt: params.expiresAt - ? new Date(params.expiresAt) - : addMinutes(new Date(), 10), - type: 'INCOMING', - status: 'PENDING' - }) - } - - async createOutgoingTransaction(params: OutgoingPayment) { - const amount = params.debitAmount - return WMTransaction.query().insert({ - walletAddressId: params.walletAddressId, - paymentId: params.id, - value: amount.value, - type: 'OUTGOING', - status: 'PENDING' - }) - } - - async deleteByTransactionIds(ids: string[], trx?: TransactionOrKnex) { - return WMTransaction.query(trx).del().whereIn('id', ids) - } - - async sumByWalletAddressId( - walletAddressId: string, - type: TransactionType, - trx?: TransactionOrKnex - ) { - const transactions = await WMTransaction.query(trx).where({ - walletAddressId, - type, - status: 'COMPLETED' - }) - const ids = transactions.map(({ id }) => id) - const sumResult = (await WMTransaction.query(trx) - .whereIn('id', ids) - .sum('value')) as unknown as [{ sum: bigint }] - - return { - ids, - sum: sumResult[0].sum ?? 0n - } - } -} diff --git a/packages/wallet/backend/tests/rafiki/service.test.ts b/packages/wallet/backend/tests/rafiki/service.test.ts index b096ee9e0..f935636f9 100644 --- a/packages/wallet/backend/tests/rafiki/service.test.ts +++ b/packages/wallet/backend/tests/rafiki/service.test.ts @@ -64,7 +64,6 @@ describe('Rafiki Service', () => { walletAddressService: { findByIdWithoutValidation: () => walletAddress || mockWalletAddress }, - wmTransactionService: {}, env: bindings.resolve('env'), logger: bindings.resolve('logger') } diff --git a/packages/wallet/backend/tests/walletAddress/controller.test.ts b/packages/wallet/backend/tests/walletAddress/controller.test.ts index b0fc1acfc..bdff93e83 100644 --- a/packages/wallet/backend/tests/walletAddress/controller.test.ts +++ b/packages/wallet/backend/tests/walletAddress/controller.test.ts @@ -135,8 +135,7 @@ describe('Wallet Address', () => { } req.body = { walletAddressName: faker.lorem.slug(), - publicName: faker.lorem.words({ min: 2, max: 2 }), - isWM: false + publicName: faker.lorem.words({ min: 2, max: 2 }) } await walletAddressController.create(req, res, next) expect(res.statusCode).toBe(200) @@ -156,8 +155,7 @@ describe('Wallet Address', () => { } req.body = { walletAddressName: faker.lorem.slug(), - publicName: faker.lorem.words({ min: 2, max: 2 }), - isWM: false + publicName: faker.lorem.words({ min: 2, max: 2 }) } await walletAddressController.create(req, res, (err) => { next() diff --git a/packages/wallet/backend/tests/walletAddress/service.test.ts b/packages/wallet/backend/tests/walletAddress/service.test.ts index 71120519c..f5e5a0602 100644 --- a/packages/wallet/backend/tests/walletAddress/service.test.ts +++ b/packages/wallet/backend/tests/walletAddress/service.test.ts @@ -30,7 +30,8 @@ describe('Wallet Address Service', () => { const prepareWADependencies = async ( paymentPointerName: string, isAccountAssigned = true, - isWM?: { assetCode?: string; assetScale?: number; isWM: boolean } + assetCode?: string, + assetScale?: number ) => { let extraAcc = {} as Account if (!isAccountAssigned) @@ -57,9 +58,8 @@ describe('Wallet Address Service', () => { publicName: faker.string.alpha(10), accountId: isAccountAssigned ? account.id : extraAcc.id, id: faker.string.uuid(), - assetCode: isWM?.assetCode || undefined, - assetScale: isWM?.assetScale || undefined, - isWM: isWM?.isWM + assetCode: assetCode || undefined, + assetScale: assetScale || undefined }) return { @@ -75,7 +75,8 @@ describe('Wallet Address Service', () => { logger, cache: { get: jest.fn(), - set: jest.fn() + set: jest.fn(), + delete: jest.fn() }, rafikiClient: { createRafikiWalletAddress: () => ({ @@ -88,12 +89,12 @@ describe('Wallet Address Service', () => { revokeWalletAddressKey: jest.fn(), updateWalletAddress: jest.fn() }, - wmTransactionService: { - deleteByTransactionIds: jest.fn(), - sumByWalletAddressId: () => ({ + transactionService: { + sumByWalletAddressIdSince: () => ({ ids: [uuid()], sum: sumWS - }) + }), + updateTransaction: jest.fn() } } @@ -144,8 +145,7 @@ describe('Wallet Address Service', () => { userId, accountId: account.id, walletAddressName: 'my-wallet', - publicName: 'My Wallet', - isWM: false + publicName: 'My Wallet' }) expect(result).toHaveProperty('publicName') expect(result).toHaveProperty('accountId') @@ -162,8 +162,7 @@ describe('Wallet Address Service', () => { userId, accountId: account.id, walletAddressName: 'my-wallet', - publicName: 'My Wallet', - isWM: false + publicName: 'My Wallet' }) expect(result).toHaveProperty('publicName') expect(result).toHaveProperty('accountId') @@ -181,8 +180,7 @@ describe('Wallet Address Service', () => { userId, accountId: account.id, walletAddressName: 'my-work', - publicName: 'My Work', - isWM: false + publicName: 'My Work' }) ).rejects.toThrowError( /This payment pointer already exists. Please choose another name./ @@ -195,9 +193,7 @@ describe('Wallet Address Service', () => { const { account, walletAddress } = await prepareWADependencies('my-wallet') const result = await waService.list(userId, account.id) - expect(result).toHaveProperty('wmWalletAddresses') - expect(result).toHaveProperty('walletAddresses') - expect(result.walletAddresses[0]).toMatchObject({ + expect(result[0]).toMatchObject({ url: walletAddress.url, accountId: account.id }) @@ -293,7 +289,7 @@ describe('Wallet Address Service', () => { url: `${serviceEnv.OPEN_PAYMENTS_HOST}/test`, publicName: 'Test Wallet', assetCode: 'USD', - assetScale: 2 + assetScale: 9 } }) ) @@ -307,7 +303,7 @@ describe('Wallet Address Service', () => { url: `${serviceEnv.OPEN_PAYMENTS_HOST}/test`, publicName: 'Test Wallet', assetCode: 'USD', - assetScale: 2 + assetScale: 9 }) }) }) @@ -332,37 +328,30 @@ describe('Wallet Address Service', () => { }) }) - describe('Sum By Wallet AddressId', () => { - it('should return undefined by zero sum', async () => { - await prepareWADependencies('my-wallet', true, { - assetCode: 'USD', - assetScale: 2, - isWM: true - }) + describe('Sum By Wallet AddressId Since', () => { + it('should complete without errors for zero sum', async () => { + await prepareWADependencies('my-wallet', true, 'USD', 9) - const result = await waService.processWMWalletAddresses() - expect(result).toBeUndefined() + await expect( + waService.keepBalancesSynced(new Date(0)) + ).resolves.toBeUndefined() }) - it('should return undefined by non zero sum', async () => { + it('should complete without errors for non-zero sum', async () => { prepareWSDepsMock(1000n) - await prepareWADependencies('my-wallet', true, { - assetCode: 'USD', - assetScale: 2, - isWM: true - }) - - const result = await waService.processWMWalletAddresses() - expect(result).toBeUndefined() + await prepareWADependencies('my-wallet', true, 'USD', 9) + await expect( + waService.keepBalancesSynced(new Date(0)) + ).resolves.toBeUndefined() }) - it('should throw missing assetCode err', async () => { - await prepareWADependencies('my-wallet', true, { isWM: true }) + it('should throw missing assetCode error', async () => { + await prepareWADependencies('my-wallet', true) - await expect(waService.processWMWalletAddresses()).rejects.toThrowError( - /Error while processing WM payment pointers/ - ) + await expect( + waService.keepBalancesSynced(new Date(0)) + ).rejects.toThrowError(/Error while processing payment pointers/) }) }) }) diff --git a/packages/wallet/frontend/package.json b/packages/wallet/frontend/package.json index cbf7d0727..d0203b408 100644 --- a/packages/wallet/frontend/package.json +++ b/packages/wallet/frontend/package.json @@ -13,7 +13,7 @@ "class-variance-authority": "^0.7.0", "@wallet/shared": "workspace:*", "ky": "^1.5.0", - "next": "14.1.1", + "next": "14.2.5", "nprogress": "^0.2.0", "react": "18.3.1", "react-dom": "18.3.1", diff --git a/packages/wallet/frontend/src/components/cards/AccountCard.tsx b/packages/wallet/frontend/src/components/cards/AccountCard.tsx index b8a81c2e3..0968573be 100644 --- a/packages/wallet/frontend/src/components/cards/AccountCard.tsx +++ b/packages/wallet/frontend/src/components/cards/AccountCard.tsx @@ -5,13 +5,19 @@ import { useMemo } from 'react' import { useOnboardingContext } from '@/lib/context/onboarding' import { balanceState } from '@/lib/balance' import { useSnapshot } from 'valtio' +import { BASE_ASSET_SCALE } from '@/utils/constants' type AccountCardProps = { account: Account idOnboarding?: string + incomingOutgoingBalance: number } -export const AccountCard = ({ account, idOnboarding }: AccountCardProps) => { +export const AccountCard = ({ + account, + idOnboarding, + incomingOutgoingBalance +}: AccountCardProps) => { const { isUserFirstTime, setRunOnboarding } = useOnboardingContext() const { accountsSnapshot } = useSnapshot(balanceState) @@ -19,12 +25,22 @@ export const AccountCard = ({ account, idOnboarding }: AccountCardProps) => { const snapshotAccount = accountsSnapshot.find( (item) => item.assetCode === account.assetCode ) + + const snapshotBalance = snapshotAccount + ? Number(snapshotAccount.balance) + : 0 + const accountBalance = Number(account.balance) + const value = ( + (snapshotBalance || accountBalance) + incomingOutgoingBalance + ).toString() + return formatAmount({ - value: snapshotAccount?.balance || account.balance, + value, + displayScale: BASE_ASSET_SCALE, assetCode: account.assetCode, assetScale: account.assetScale }) - }, [account, accountsSnapshot]) + }, [account, accountsSnapshot, incomingOutgoingBalance]) return ( { - return formatAmount({ - value: String(walletAddress.incomingBalance) || '', - assetCode: walletAddress.assetCode || '', - assetScale: walletAddress.assetScale || 2 - }) -} const WalletAddressCardButton = forwardRef< HTMLButtonElement | HTMLAnchorElement, @@ -61,7 +52,6 @@ WalletAddressCardButton.displayName = 'WalletAddressCardButton' export const WalletAddressCard = ({ walletAddress, - isWM, idOnboarding }: WalletAddressCardProps) => { return ( @@ -69,19 +59,14 @@ export const WalletAddressCard = ({
{walletAddress.url}
- {isWM ? ( - - {formattedAmount(walletAddress).amount} - - ) : ( - - View - - )} + + View + + & { accountName: string @@ -71,11 +69,9 @@ export const CreateWalletAddressDialog = ({
-
{ - data.isWM = isWebMonetization ? true : data.isWM const response = await walletAddressService.create( accountId, data @@ -135,14 +131,6 @@ export const CreateWalletAddressDialog = ({ } {...createWalletAddressForm.register('publicName')} /> - { - if (isWebMonetization) e.preventDefault() - }} - {...createWalletAddressForm.register('isWM')} - />
- { - if (isUserFirstTime) { - setRunOnboarding(false) - } - openDialog( - - ) - }} - className="group flex aspect-square h-24 w-24 flex-col items-center justify-center rounded-lg border border-green-5 bg-white shadow-md hover:border-green-6" - > - - - Add money - - - - openDialog( - - ) - } - className="group flex aspect-square h-24 w-24 flex-col items-center justify-center rounded-lg border border-green-5 bg-white shadow-md hover:border-green-6" - > - - - Withdraw - - - - - - Exchange - - -
-
-

- Payment Pointers -

-
-
- {allWalletAddresses.walletAddresses.length > 0 ? ( - allWalletAddresses.walletAddresses.map( - (walletAddress, index) => ( - - ) - ) - ) : ( -
- No payment pointers found for this account. -
- )} -
+ + { + if (isUserFirstTime) { + setRunOnboarding(false) + } + openDialog( + + ) + }} + className="group flex aspect-square h-24 w-24 flex-col items-center justify-center rounded-lg border border-green-5 bg-white shadow-md hover:border-green-6" + > + + + Add money + + + + openDialog( + + ) + } + className="group flex aspect-square h-24 w-24 flex-col items-center justify-center rounded-lg border border-green-5 bg-white shadow-md hover:border-green-6" + > + + + Withdraw + + + + + + Exchange + + +
+
+

+ Payment Pointers +

+
+
+ {allWalletAddresses.length > 0 ? ( + allWalletAddresses.map((walletAddress, index) => ( + + )) + ) : ( +
+ No payment pointers found for this account.
- - - {account.assetCode === 'USD' ? ( - <> -
- -
-

Balance

-

- {balance.amount} -

-
-
-
- -
-
-
-

- Account -

-
-
- - {account.name} - - - {formattedAmount.symbol} - -
-
- {allWalletAddresses.wmWalletAddresses.length > 0 ? ( - allWalletAddresses.wmWalletAddresses.map( - (walletAddress) => ( - - ) - ) - ) : ( -
- - No web monetization payment pointers found for this - account. - -
- )} -
-
- - ) : ( - - )} -
- - + )} +
+
) } @@ -321,8 +200,8 @@ const querySchema = z.object({ export const getServerSideProps: GetServerSideProps<{ account: Account - allWalletAddresses: ListWalletAddressesResponse - balance: FormattedAmount + allWalletAddresses: WalletAddressResponse[] + balance: number }> = async (ctx) => { const result = querySchema.safeParse(ctx.query) if (!result.success) { @@ -347,25 +226,17 @@ export const getServerSideProps: GetServerSideProps<{ } } - let balance = 0 + const balance = calculateBalance(walletAddressesResponse.result) - walletAddressesResponse.result.walletAddresses.map((pp) => { - pp.url = replaceWalletAddressProtocol(pp.url) - }) - walletAddressesResponse.result.wmWalletAddresses.map((pp) => { + walletAddressesResponse.result.map((pp) => { pp.url = replaceWalletAddressProtocol(pp.url) - balance += Number(pp.incomingBalance) }) return { props: { account: accountResponse.result, allWalletAddresses: walletAddressesResponse.result, - balance: formatAmount({ - value: balance.toString(), - assetCode: accountResponse.result.assetCode, - assetScale: 9 - }) + balance } } } diff --git a/packages/wallet/frontend/src/pages/account/create.tsx b/packages/wallet/frontend/src/pages/account/create.tsx index 800432a27..9c419eb90 100644 --- a/packages/wallet/frontend/src/pages/account/create.tsx +++ b/packages/wallet/frontend/src/pages/account/create.tsx @@ -19,6 +19,7 @@ import { NextPageWithLayout } from '@/lib/types/app' import { useOnboardingContext } from '@/lib/context/onboarding' import { useEffect } from 'react' import { createAccountSchema } from '@wallet/shared' +import { MAX_ASSET_SCALE } from '@/utils/constants' type CreateAccountProps = InferGetServerSidePropsType const CreateAccountPage: NextPageWithLayout = ({ @@ -138,7 +139,7 @@ export const getServerSideProps: GetServerSideProps<{ } const assets = response.result - ?.filter((asset) => asset.scale <= 2) + ?.filter((asset) => asset.scale <= MAX_ASSET_SCALE) ?.map((asset) => ({ value: asset.id, label: asset.code diff --git a/packages/wallet/frontend/src/pages/exchange.tsx b/packages/wallet/frontend/src/pages/exchange.tsx index fa4c890b3..ded6d2031 100644 --- a/packages/wallet/frontend/src/pages/exchange.tsx +++ b/packages/wallet/frontend/src/pages/exchange.tsx @@ -26,6 +26,7 @@ import { balanceState } from '@/lib/balance' import { useSnapshot } from 'valtio' import { exchangeAssetSchema } from '@wallet/shared' import { AssetOP } from '@wallet/shared' +import { MAX_ASSET_SCALE } from '@/utils/constants' type ExchangeAssetProps = InferGetServerSidePropsType const ExchangeAssetPage: NextPageWithLayout = ({ @@ -49,8 +50,16 @@ const ExchangeAssetPage: NextPageWithLayout = ({ const snapshotAccount = accountsSnapshot.find( (item) => item.assetCode === account.assetCode ) + + const snapshotBalance = snapshotAccount + ? Number(snapshotAccount.balance) + : 0 + const accountBalance = Number(account.balance) + + const value = (snapshotBalance || accountBalance).toString() + return formatAmount({ - value: snapshotAccount?.balance || account.balance, + value, assetCode: account.assetCode, assetScale: account.assetScale }) @@ -242,7 +251,7 @@ export const getServerSideProps: GetServerSideProps<{ } const assets = assetResponse.result - ?.filter((asset) => asset.scale <= 2) + ?.filter((asset) => asset.scale <= MAX_ASSET_SCALE) ?.map((asset) => ({ value: asset.id, label: asset.code diff --git a/packages/wallet/frontend/src/pages/grant-interactions/index.tsx b/packages/wallet/frontend/src/pages/grant-interactions/index.tsx index 3087a2874..6bafe84fe 100644 --- a/packages/wallet/frontend/src/pages/grant-interactions/index.tsx +++ b/packages/wallet/frontend/src/pages/grant-interactions/index.tsx @@ -11,6 +11,7 @@ import { useDialog } from '@/lib/hooks/useDialog' import { ErrorDialog } from '@/components/dialogs/ErrorDialog' import { useRouter } from 'next/router' import { GrantResponse } from '@wallet/shared' +import { BASE_ASSET_SCALE } from '@/utils/constants' type GrantInteractionPageProps = InferGetServerSidePropsType< typeof getServerSideProps @@ -181,7 +182,8 @@ export const getServerSideProps: GetServerSideProps<{ access.limits.debitAmount.formattedAmount = formatAmount({ value: access.limits.debitAmount.value ?? 0, assetCode: access.limits.debitAmount.assetCode, - assetScale: access.limits.debitAmount.assetScale + assetScale: access.limits.debitAmount.assetScale, + displayScale: BASE_ASSET_SCALE }).amount } } diff --git a/packages/wallet/frontend/src/pages/index.tsx b/packages/wallet/frontend/src/pages/index.tsx index 7568e8c7b..ee98a3fcb 100644 --- a/packages/wallet/frontend/src/pages/index.tsx +++ b/packages/wallet/frontend/src/pages/index.tsx @@ -16,10 +16,16 @@ import { userService } from '@/lib/api/user' import type { NextPageWithLayout } from '@/lib/types/app' import { useOnboardingContext } from '@/lib/context/onboarding' import { useEffect } from 'react' +import { calculateBalance } from '@/utils/helpers' +import { walletAddressService } from '@/lib/api/walletAddress' type HomeProps = InferGetServerSidePropsType -const HomePage: NextPageWithLayout = ({ accounts, user }) => { +const HomePage: NextPageWithLayout = ({ + accounts, + incomingOutgoingBalances, + user +}) => { const { isUserFirstTime, setRunOnboarding, stepIndex, setStepIndex } = useOnboardingContext() @@ -107,6 +113,7 @@ const HomePage: NextPageWithLayout = ({ accounts, user }) => { ))} @@ -124,28 +131,47 @@ const HomePage: NextPageWithLayout = ({ accounts, user }) => { export const getServerSideProps: GetServerSideProps<{ accounts: Account[] + incomingOutgoingBalances: Record user: { firstName: string lastName: string email: string } }> = async (ctx) => { - const response = await accountService.list(ctx.req.headers.cookie) - const user = await userService.me(ctx.req.headers.cookie) + const accountsResponse = await accountService.list(ctx.req.headers.cookie) + const userResponse = await userService.me(ctx.req.headers.cookie) - if (!response.success || !user.success) { + if ( + !accountsResponse.success || + !userResponse.success || + !accountsResponse.result + ) { return { notFound: true } } + const incomingOutgoingBalances: Record = {} + for (const account of accountsResponse.result) { + const walletAddressesResponse = await walletAddressService.list( + account.id, + ctx.req.headers.cookie + ) + if (walletAddressesResponse.success && walletAddressesResponse.result) { + incomingOutgoingBalances[account.id] = calculateBalance( + walletAddressesResponse.result + ) + } + } + return { props: { - accounts: response.result ?? [], + accounts: accountsResponse.result ?? [], + incomingOutgoingBalances, user: { - firstName: user.result?.firstName ?? '', - lastName: user.result?.lastName ?? '', - email: user.result?.email ?? '' + firstName: userResponse.result?.firstName ?? '', + lastName: userResponse.result?.lastName ?? '', + email: userResponse.result?.email ?? '' } } } diff --git a/packages/wallet/frontend/src/pages/transactions.tsx b/packages/wallet/frontend/src/pages/transactions.tsx index d9758fbc7..d71cef38e 100644 --- a/packages/wallet/frontend/src/pages/transactions.tsx +++ b/packages/wallet/frontend/src/pages/transactions.tsx @@ -20,6 +20,7 @@ import { cx } from 'class-variance-authority' import { IconButton } from '@/ui/IconButton' import { Play } from '@/components/icons/Play' import { Label } from '@/ui/forms/Label' +import { ASSET_SCALE_IMBALANCE } from '@/utils/constants' type WalletAddressSelectOption = SelectOption & { accountId: string @@ -280,53 +281,57 @@ const TransactionsPage: NextPageWithLayout = ({ /> {transactions.results.length ? ( - transactions.results.map((trx) => ( - - {trx.accountName} - - {trx.walletAddressPublicName ?? - trx.walletAddressUrl ?? - ''} - {trx.walletAddressUrl ? ( - - {trx.walletAddressUrl} - - ) : null} - - - {trx.description ? ( - trx.description - ) : ( -

No description

- )} -
- - {trx.type === 'INCOMING' ? '+' : '-'} - { - formatAmount({ - value: String(trx.value) ?? 0, - assetCode: trx.assetCode, - assetScale: trx.assetScale - }).amount - } - - - - - - {formatDate({ date: trx.createdAt.toString() })} - -
- )) + transactions.results.map((trx) => + trx.description !== ASSET_SCALE_IMBALANCE ? ( + <> + + {trx.accountName} + + {trx.walletAddressPublicName ?? + trx.walletAddressUrl ?? + ''} + {trx.walletAddressUrl ? ( + + {trx.walletAddressUrl} + + ) : null} + + + {trx.description ? ( + trx.description + ) : ( +

No description

+ )} +
+ + {trx.type === 'INCOMING' ? '+' : '-'} + { + formatAmount({ + value: String(trx.value) ?? 0, + assetCode: trx.assetCode, + assetScale: trx.assetScale + }).amount + } + + + + + + {formatDate({ date: trx.createdAt.toString() })} + +
+ + ) : null + ) ) : ( diff --git a/packages/wallet/frontend/src/pages/transfer/request.tsx b/packages/wallet/frontend/src/pages/transfer/request.tsx index 93a413b75..2bf33f1ae 100644 --- a/packages/wallet/frontend/src/pages/transfer/request.tsx +++ b/packages/wallet/frontend/src/pages/transfer/request.tsx @@ -11,6 +11,7 @@ import { useDialog } from '@/lib/hooks/useDialog' import { TimeUnit, requestSchema, transfersService } from '@/lib/api/transfers' import { SuccessDialog } from '@/components/dialogs/SuccessDialog' import { + calculateBalance, formatAmount, getObjectKeys, replaceWalletAddressProtocol @@ -44,7 +45,10 @@ const timeUnitOptions: SelectTimeUnitOption[] = [ type RequestProps = InferGetServerSidePropsType -const RequestPage: NextPageWithLayout = ({ accounts }) => { +const RequestPage: NextPageWithLayout = ({ + accounts, + incomingOutgoingBalances +}) => { const [openDialog, closeDialog] = useDialog() const { isUserFirstTime, setRunOnboarding, stepIndex, setStepIndex } = useOnboardingContext() @@ -67,12 +71,23 @@ const RequestPage: NextPageWithLayout = ({ accounts }) => { item.assetCode === selectedAccount.assetCode && item.assetScale === selectedAccount.assetScale ) + + const snapshotBalance = snapshotAccount + ? Number(snapshotAccount.balance) + : 0 + const accountBalance = Number(selectedAccount.balance) + + const value = ( + (snapshotBalance || accountBalance) + + incomingOutgoingBalances[selectedAccount.value] + ).toString() + return formatAmount({ - value: snapshotAccount?.balance || selectedAccount.balance, + value, assetCode: selectedAccount.assetCode, assetScale: selectedAccount.assetScale }).amount - }, [accountsSnapshot, selectedAccount]) + }, [accountsSnapshot, selectedAccount, incomingOutgoingBalances]) useEffect(() => { if (isUserFirstTime) { @@ -104,7 +119,7 @@ const RequestPage: NextPageWithLayout = ({ accounts }) => { return } - const walletAddresses = walletAddressesResponse.result.walletAddresses.map( + const walletAddresses = walletAddressesResponse.result.map( (walletAddress) => ({ label: `${walletAddress.publicName} (${replaceWalletAddressProtocol(walletAddress.url)})`, value: walletAddress.id, @@ -314,20 +329,28 @@ type SelectAccountOption = SelectOption & } export const getServerSideProps: GetServerSideProps<{ accounts: SelectAccountOption[] + incomingOutgoingBalances: Record }> = async (ctx) => { const [accountsResponse] = await Promise.all([ accountService.list(ctx.req.headers.cookie) ]) - if (!accountsResponse.success) { + if (!accountsResponse.success || !accountsResponse.result) { return { notFound: true } } - if (!accountsResponse.result) { - return { - notFound: true + const incomingOutgoingBalances: Record = {} + for (const account of accountsResponse.result) { + const walletAddressesResponse = await walletAddressService.list( + account.id, + ctx.req.headers.cookie + ) + if (walletAddressesResponse.success && walletAddressesResponse.result) { + incomingOutgoingBalances[account.id] = calculateBalance( + walletAddressesResponse.result + ) } } @@ -341,7 +364,8 @@ export const getServerSideProps: GetServerSideProps<{ return { props: { - accounts + accounts, + incomingOutgoingBalances } } } diff --git a/packages/wallet/frontend/src/pages/transfer/send.tsx b/packages/wallet/frontend/src/pages/transfer/send.tsx index 140c276cf..cf0867afb 100644 --- a/packages/wallet/frontend/src/pages/transfer/send.tsx +++ b/packages/wallet/frontend/src/pages/transfer/send.tsx @@ -14,6 +14,7 @@ import { accountService } from '@/lib/api/account' import { sendSchema, transfersService } from '@/lib/api/transfers' import { SuccessDialog } from '@/components/dialogs/SuccessDialog' import { + calculateBalance, formatAmount, getObjectKeys, replaceWalletAddressProtocol @@ -39,7 +40,10 @@ import { AssetOP } from '@wallet/shared' type SendProps = InferGetServerSidePropsType -const SendPage: NextPageWithLayout = ({ accounts }) => { +const SendPage: NextPageWithLayout = ({ + accounts, + incomingOutgoingBalances +}) => { const [openDialog, closeDialog] = useDialog() const { isUserFirstTime, setRunOnboarding, stepIndex, setStepIndex } = useOnboardingContext() @@ -66,12 +70,22 @@ const SendPage: NextPageWithLayout = ({ accounts }) => { item.assetCode === selectedAccount.assetCode && item.assetScale === selectedAccount.assetScale ) + + const snapshotBalance = snapshotAccount + ? Number(snapshotAccount.balance) + : 0 + const accountBalance = Number(selectedAccount.balance) + const value = ( + (snapshotBalance || accountBalance) + + incomingOutgoingBalances[selectedAccount.value] + ).toString() + return formatAmount({ - value: snapshotAccount?.balance || selectedAccount.balance, + value, assetCode: selectedAccount.assetCode, assetScale: selectedAccount.assetScale }).amount - }, [accountsSnapshot, selectedAccount]) + }, [accountsSnapshot, selectedAccount, incomingOutgoingBalances]) const sendForm = useZodForm({ schema: sendSchema, @@ -114,7 +128,7 @@ const SendPage: NextPageWithLayout = ({ accounts }) => { return } - const walletAddresses = walletAddressesResponse.result.walletAddresses.map( + const walletAddresses = walletAddressesResponse.result.map( (walletAddress) => ({ label: `${walletAddress.publicName} (${replaceWalletAddressProtocol(walletAddress.url)})`, value: walletAddress.id @@ -480,20 +494,28 @@ type SelectAccountOption = SelectOption & } export const getServerSideProps: GetServerSideProps<{ accounts: SelectAccountOption[] + incomingOutgoingBalances: Record }> = async (ctx) => { const [accountsResponse] = await Promise.all([ accountService.list(ctx.req.headers.cookie) ]) - if (!accountsResponse.success) { + if (!accountsResponse.success || !accountsResponse.result) { return { notFound: true } } - if (!accountsResponse.result) { - return { - notFound: true + const incomingOutgoingBalances: Record = {} + for (const account of accountsResponse.result) { + const walletAddressesResponse = await walletAddressService.list( + account.id, + ctx.req.headers.cookie + ) + if (walletAddressesResponse.success && walletAddressesResponse.result) { + incomingOutgoingBalances[account.id] = calculateBalance( + walletAddressesResponse.result + ) } } @@ -507,7 +529,8 @@ export const getServerSideProps: GetServerSideProps<{ return { props: { - accounts + accounts, + incomingOutgoingBalances } } } diff --git a/packages/wallet/frontend/src/utils/constants.ts b/packages/wallet/frontend/src/utils/constants.ts index bcac57bd8..7109e16d8 100644 --- a/packages/wallet/frontend/src/utils/constants.ts +++ b/packages/wallet/frontend/src/utils/constants.ts @@ -19,6 +19,12 @@ export const INTERLEDGER_WALLET_ADDRESS = '$ilp.rafiki.money/interledger' // Default number of grants to be shown on page export const GRANTS_DISPLAY_NR = 10 -//Default Base64 encoded Public Key +// Default Base64 encoded Public Key export const BASE64_PUBLIC_KEY = 'ewogICJrdHkiOiAiT0tQIiwKICAiY3J2IjogIkVkMjU1MTkiLAogICJraWQiOiAidGVzdC1rZXktZWQyNTUxOSIsCiAgIngiOiAiSnJRTGo1UF84OWlYRVM5LXZGZ3JJeTI5Y2xGOUNDX29QUHN3M2M1RDBicyIKfQ==' + +// Transaction asset scale 9 imbalance note +export const ASSET_SCALE_IMBALANCE = 'Asset scale 9 imbalance' + +export const MAX_ASSET_SCALE = 9 +export const BASE_ASSET_SCALE = 2 diff --git a/packages/wallet/frontend/src/utils/helpers.ts b/packages/wallet/frontend/src/utils/helpers.ts index ac16801d6..1a18f6ae2 100644 --- a/packages/wallet/frontend/src/utils/helpers.ts +++ b/packages/wallet/frontend/src/utils/helpers.ts @@ -2,6 +2,8 @@ import { cx, CxOptions } from 'class-variance-authority' import { twMerge } from 'tailwind-merge' import { AssetOP } from '@wallet/shared' import { QuoteResponse } from '@wallet/shared' +import { WalletAddressResponse } from '@wallet/shared' +import { BASE_ASSET_SCALE, MAX_ASSET_SCALE } from './constants' /** * `getObjectKeys` should be used only when we have additional knowledge. @@ -35,18 +37,24 @@ export const getCurrencySymbol = (assetCode: string): string => { type FormatAmountArgs = AssetOP & { value: string + displayScale?: number } export const formatAmount = (args: FormatAmountArgs): FormattedAmount => { - const { value, assetCode, assetScale } = args + const { value, displayScale = MAX_ASSET_SCALE, assetCode, assetScale } = args + + const scaledValue = Number(`${value}e-${assetScale}`) + const flooredValue = + Math.floor(scaledValue * 10 ** displayScale) / 10 ** displayScale + const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: assetCode, - maximumFractionDigits: assetScale, - minimumFractionDigits: assetScale + maximumFractionDigits: displayScale, + minimumFractionDigits: displayScale }) - const amount = formatter.format(Number(`${value}e-${assetScale}`)) + const amount = formatter.format(flooredValue) const symbol = getCurrencySymbol(assetCode) return { @@ -78,15 +86,18 @@ export const getFee = (quote: QuoteResponse): FormattedAmount => { return formatAmount({ assetCode: quote.fee.assetCode, assetScale: quote.fee.assetScale, - value: quote.fee.value.toString() + displayScale: BASE_ASSET_SCALE, + value: quote.fee.value }) } const fee = BigInt(quote.debitAmount.value) - BigInt(quote.receiveAmount.value) + return formatAmount({ assetCode: quote.debitAmount.assetCode, assetScale: quote.debitAmount.assetScale, + displayScale: BASE_ASSET_SCALE, value: fee.toString() }) } @@ -132,3 +143,17 @@ export const replaceWalletAddressProtocol = ( ? paymentPointer.replace('http://', '$') : paymentPointer } + +export const calculateBalance = ( + walletAddresses?: WalletAddressResponse[] +): number => { + if (!walletAddresses || !Array.isArray(walletAddresses)) { + return 0 + } + + return walletAddresses.reduce((acc, pp) => { + const incoming = Number(pp.incomingBalance) || 0 + const outgoing = Number(pp.outgoingBalance) || 0 + return acc + (incoming - outgoing) + }, 0) +} diff --git a/packages/wallet/shared/src/types/index.ts b/packages/wallet/shared/src/types/index.ts index 502c50ac3..b7ed26a8a 100644 --- a/packages/wallet/shared/src/types/index.ts +++ b/packages/wallet/shared/src/types/index.ts @@ -6,4 +6,5 @@ export * from './incomingPayment' export * from './transaction' export * from './grant' export * from './walletAddress' +export * from './walletAddressKey' export * from './user' diff --git a/packages/wallet/shared/src/types/walletAddress.ts b/packages/wallet/shared/src/types/walletAddress.ts index 6a54a6a5e..addb1d224 100644 --- a/packages/wallet/shared/src/types/walletAddress.ts +++ b/packages/wallet/shared/src/types/walletAddress.ts @@ -1,5 +1,5 @@ import { AssetOP } from './asset' -import { WalletAddressKeyResponse } from './WalletAddressKey' +import { WalletAddressKeyResponse } from './walletAddressKey' export interface IWalletAddressResponse { id: string @@ -16,11 +16,6 @@ export interface WalletAddressResponse extends IWalletAddressResponse { keys: WalletAddressKeyResponse[] } -export interface ListWalletAddressesResponse { - wmWalletAddresses: Array - walletAddresses: Array -} - export type WalletAddressOP = AssetOP & { id: string publicName: string diff --git a/packages/wallet/shared/src/types/WalletAddressKey.ts b/packages/wallet/shared/src/types/walletAddressKey.ts similarity index 100% rename from packages/wallet/shared/src/types/WalletAddressKey.ts rename to packages/wallet/shared/src/types/walletAddressKey.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01201f515..571f8ee32 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -195,7 +195,7 @@ importers: version: 18.3.0 '@vitejs/plugin-react-swc': specifier: ^3.7.0 - version: 3.7.0(@swc/helpers@0.5.2)(vite@5.3.5(@types/node@20.12.11)) + version: 3.7.0(@swc/helpers@0.5.5)(vite@5.3.5(@types/node@20.12.11)) autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.41) @@ -317,7 +317,7 @@ importers: version: 5.4.1 iron-session: specifier: ^6.3.1 - version: 6.3.1(express@4.19.2)(koa@2.14.2)(next@14.1.1(@babel/core@7.23.0)(babel-plugin-macros@3.1.0)) + version: 6.3.1(express@4.19.2)(koa@2.14.2)(next@14.2.5(@babel/core@7.23.0)(babel-plugin-macros@3.1.0)) knex: specifier: ^3.1.0 version: 3.1.0(pg@8.12.0) @@ -419,8 +419,8 @@ importers: specifier: ^1.5.0 version: 1.5.0 next: - specifier: 14.1.1 - version: 14.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.2.5 + version: 14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) nprogress: specifier: ^0.2.0 version: 0.2.0 @@ -1638,62 +1638,62 @@ packages: '@next/bundle-analyzer@13.5.4': resolution: {integrity: sha512-2vgmkuSKyTiyI7NorL+zYerxQRvzmSGbCDr2/kVrbKX28a4UNhbYn8/cQW8z6pvx0EncEFpd0GCUA5r9aRLhJg==} - '@next/env@14.1.1': - resolution: {integrity: sha512-7CnQyD5G8shHxQIIg3c7/pSeYFeMhsNbpU/bmvH7ZnDql7mNRgg8O2JZrhrc/soFnfBnKP4/xXNiiSIPn2w8gA==} + '@next/env@14.2.5': + resolution: {integrity: sha512-/zZGkrTOsraVfYjGP8uM0p6r0BDT6xWpkjdVbcz66PJVSpwXX3yNiRycxAuDfBKGWBrZBXRuK/YVlkNgxHGwmA==} '@next/eslint-plugin-next@13.5.4': resolution: {integrity: sha512-vI94U+D7RNgX6XypSyjeFrOzxGlZyxOplU0dVE5norIfZGn/LDjJYPHdvdsR5vN1eRtl6PDAsOHmycFEOljK5A==} - '@next/swc-darwin-arm64@14.1.1': - resolution: {integrity: sha512-yDjSFKQKTIjyT7cFv+DqQfW5jsD+tVxXTckSe1KIouKk75t1qZmj/mV3wzdmFb0XHVGtyRjDMulfVG8uCKemOQ==} + '@next/swc-darwin-arm64@14.2.5': + resolution: {integrity: sha512-/9zVxJ+K9lrzSGli1///ujyRfon/ZneeZ+v4ptpiPoOU+GKZnm8Wj8ELWU1Pm7GHltYRBklmXMTUqM/DqQ99FQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@14.1.1': - resolution: {integrity: sha512-KCQmBL0CmFmN8D64FHIZVD9I4ugQsDBBEJKiblXGgwn7wBCSe8N4Dx47sdzl4JAg39IkSN5NNrr8AniXLMb3aw==} + '@next/swc-darwin-x64@14.2.5': + resolution: {integrity: sha512-vXHOPCwfDe9qLDuq7U1OYM2wUY+KQ4Ex6ozwsKxp26BlJ6XXbHleOUldenM67JRyBfVjv371oneEvYd3H2gNSA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@14.1.1': - resolution: {integrity: sha512-YDQfbWyW0JMKhJf/T4eyFr4b3tceTorQ5w2n7I0mNVTFOvu6CGEzfwT3RSAQGTi/FFMTFcuspPec/7dFHuP7Eg==} + '@next/swc-linux-arm64-gnu@14.2.5': + resolution: {integrity: sha512-vlhB8wI+lj8q1ExFW8lbWutA4M2ZazQNvMWuEDqZcuJJc78iUnLdPPunBPX8rC4IgT6lIx/adB+Cwrl99MzNaA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@14.1.1': - resolution: {integrity: sha512-fiuN/OG6sNGRN/bRFxRvV5LyzLB8gaL8cbDH5o3mEiVwfcMzyE5T//ilMmaTrnA8HLMS6hoz4cHOu6Qcp9vxgQ==} + '@next/swc-linux-arm64-musl@14.2.5': + resolution: {integrity: sha512-NpDB9NUR2t0hXzJJwQSGu1IAOYybsfeB+LxpGsXrRIb7QOrYmidJz3shzY8cM6+rO4Aojuef0N/PEaX18pi9OA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@14.1.1': - resolution: {integrity: sha512-rv6AAdEXoezjbdfp3ouMuVqeLjE1Bin0AuE6qxE6V9g3Giz5/R3xpocHoAi7CufRR+lnkuUjRBn05SYJ83oKNQ==} + '@next/swc-linux-x64-gnu@14.2.5': + resolution: {integrity: sha512-8XFikMSxWleYNryWIjiCX+gU201YS+erTUidKdyOVYi5qUQo/gRxv/3N1oZFCgqpesN6FPeqGM72Zve+nReVXQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@14.1.1': - resolution: {integrity: sha512-YAZLGsaNeChSrpz/G7MxO3TIBLaMN8QWMr3X8bt6rCvKovwU7GqQlDu99WdvF33kI8ZahvcdbFsy4jAFzFX7og==} + '@next/swc-linux-x64-musl@14.2.5': + resolution: {integrity: sha512-6QLwi7RaYiQDcRDSU/os40r5o06b5ue7Jsk5JgdRBGGp8l37RZEh9JsLSM8QF0YDsgcosSeHjglgqi25+m04IQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@14.1.1': - resolution: {integrity: sha512-1L4mUYPBMvVDMZg1inUYyPvFSduot0g73hgfD9CODgbr4xiTYe0VOMTZzaRqYJYBA9mana0x4eaAaypmWo1r5A==} + '@next/swc-win32-arm64-msvc@14.2.5': + resolution: {integrity: sha512-1GpG2VhbspO+aYoMOQPQiqc/tG3LzmsdBH0LhnDS3JrtDx2QmzXe0B6mSZZiN3Bq7IOMXxv1nlsjzoS1+9mzZw==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-ia32-msvc@14.1.1': - resolution: {integrity: sha512-jvIE9tsuj9vpbbXlR5YxrghRfMuG0Qm/nZ/1KDHc+y6FpnZ/apsgh+G6t15vefU0zp3WSpTMIdXRUsNl/7RSuw==} + '@next/swc-win32-ia32-msvc@14.2.5': + resolution: {integrity: sha512-Igh9ZlxwvCDsu6438FXlQTHlRno4gFpJzqPjSIBZooD22tKeI4fE/YMRoHVJHmrQ2P5YL1DoZ0qaOKkbeFWeMg==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] - '@next/swc-win32-x64-msvc@14.1.1': - resolution: {integrity: sha512-S6K6EHDU5+1KrBDLko7/c1MNy/Ya73pIAmvKeFwsF4RmBFJSO7/7YeD4FnZ4iBdzE69PpQ4sOMU9ORKeNuxe8A==} + '@next/swc-win32-x64-msvc@14.2.5': + resolution: {integrity: sha512-tEQ7oinq1/CjSG9uSTerca3v4AZ+dFa+4Yu6ihaG8Ud8ddqLQgFGcnwYls13H5X5CPDPZJdYxyeMui6muOLd4g==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2266,8 +2266,8 @@ packages: '@swc/counter@0.1.3': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} - '@swc/helpers@0.5.2': - resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} + '@swc/helpers@0.5.5': + resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} '@swc/types@0.1.8': resolution: {integrity: sha512-RNFA3+7OJFNYY78x0FYwi1Ow+iF1eF5WvmfY1nXPOEH4R2p/D4Cr1vzje7dNAI2aLFqpv8Wyz4oKSWqIZArpQA==} @@ -4795,18 +4795,21 @@ packages: resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} engines: {node: '>= 0.6'} - next@14.1.1: - resolution: {integrity: sha512-McrGJqlGSHeaz2yTRPkEucxQKe5Zq7uPwyeHNmJaZNY4wx9E9QdxmTp310agFRoMuIYgQrCrT3petg13fSVOww==} + next@14.2.5: + resolution: {integrity: sha512-0f8aRfBVL+mpzfBjYfQuLWh2WyAwtJXCRfkPF4UJ5qd2YwrHczsrSzXU4tRMV0OAxR8ZJZWPFn6uhSC56UTsLA==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 + '@playwright/test': ^1.41.2 react: ^18.2.0 react-dom: ^18.2.0 sass: ^1.3.0 peerDependenciesMeta: '@opentelemetry/api': optional: true + '@playwright/test': + optional: true sass: optional: true @@ -7958,37 +7961,37 @@ snapshots: - bufferutil - utf-8-validate - '@next/env@14.1.1': {} + '@next/env@14.2.5': {} '@next/eslint-plugin-next@13.5.4': dependencies: glob: 7.1.7 - '@next/swc-darwin-arm64@14.1.1': + '@next/swc-darwin-arm64@14.2.5': optional: true - '@next/swc-darwin-x64@14.1.1': + '@next/swc-darwin-x64@14.2.5': optional: true - '@next/swc-linux-arm64-gnu@14.1.1': + '@next/swc-linux-arm64-gnu@14.2.5': optional: true - '@next/swc-linux-arm64-musl@14.1.1': + '@next/swc-linux-arm64-musl@14.2.5': optional: true - '@next/swc-linux-x64-gnu@14.1.1': + '@next/swc-linux-x64-gnu@14.2.5': optional: true - '@next/swc-linux-x64-musl@14.1.1': + '@next/swc-linux-x64-musl@14.2.5': optional: true - '@next/swc-win32-arm64-msvc@14.1.1': + '@next/swc-win32-arm64-msvc@14.2.5': optional: true - '@next/swc-win32-ia32-msvc@14.1.1': + '@next/swc-win32-ia32-msvc@14.2.5': optional: true - '@next/swc-win32-x64-msvc@14.1.1': + '@next/swc-win32-x64-msvc@14.2.5': optional: true '@nodelib/fs.scandir@2.1.5': @@ -8486,7 +8489,7 @@ snapshots: '@swc/core-win32-x64-msvc@1.5.28': optional: true - '@swc/core@1.5.28(@swc/helpers@0.5.2)': + '@swc/core@1.5.28(@swc/helpers@0.5.5)': dependencies: '@swc/counter': 0.1.3 '@swc/types': 0.1.8 @@ -8501,12 +8504,13 @@ snapshots: '@swc/core-win32-arm64-msvc': 1.5.28 '@swc/core-win32-ia32-msvc': 1.5.28 '@swc/core-win32-x64-msvc': 1.5.28 - '@swc/helpers': 0.5.2 + '@swc/helpers': 0.5.5 '@swc/counter@0.1.3': {} - '@swc/helpers@0.5.2': + '@swc/helpers@0.5.5': dependencies: + '@swc/counter': 0.1.3 tslib: 2.6.2 '@swc/types@0.1.8': @@ -8840,9 +8844,9 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-react-swc@3.7.0(@swc/helpers@0.5.2)(vite@5.3.5(@types/node@20.12.11))': + '@vitejs/plugin-react-swc@3.7.0(@swc/helpers@0.5.5)(vite@5.3.5(@types/node@20.12.11))': dependencies: - '@swc/core': 1.5.28(@swc/helpers@0.5.2) + '@swc/core': 1.5.28(@swc/helpers@0.5.5) vite: 5.3.5(@types/node@20.12.11) transitivePeerDependencies: - '@swc/helpers' @@ -10716,7 +10720,7 @@ snapshots: ipaddr.js@1.9.1: {} - iron-session@6.3.1(express@4.19.2)(koa@2.14.2)(next@14.1.1(@babel/core@7.23.0)(babel-plugin-macros@3.1.0)): + iron-session@6.3.1(express@4.19.2)(koa@2.14.2)(next@14.2.5(@babel/core@7.23.0)(babel-plugin-macros@3.1.0)): dependencies: '@peculiar/webcrypto': 1.4.3 '@types/cookie': 0.5.2 @@ -10728,7 +10732,7 @@ snapshots: optionalDependencies: express: 4.19.2 koa: 2.14.2 - next: 14.1.1(@babel/core@7.23.0)(babel-plugin-macros@3.1.0) + next: 14.2.5(@babel/core@7.23.0)(babel-plugin-macros@3.1.0) iron-webcrypto@0.2.8: dependencies: @@ -11599,34 +11603,34 @@ snapshots: negotiator@0.6.3: {} - next@14.1.1(@babel/core@7.23.0)(babel-plugin-macros@3.1.0): + next@14.2.5(@babel/core@7.23.0)(babel-plugin-macros@3.1.0): dependencies: - '@next/env': 14.1.1 - '@swc/helpers': 0.5.2 + '@next/env': 14.2.5 + '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001649 graceful-fs: 4.2.11 postcss: 8.4.31 styled-jsx: 5.1.1(@babel/core@7.23.0)(babel-plugin-macros@3.1.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.1 - '@next/swc-darwin-x64': 14.1.1 - '@next/swc-linux-arm64-gnu': 14.1.1 - '@next/swc-linux-arm64-musl': 14.1.1 - '@next/swc-linux-x64-gnu': 14.1.1 - '@next/swc-linux-x64-musl': 14.1.1 - '@next/swc-win32-arm64-msvc': 14.1.1 - '@next/swc-win32-ia32-msvc': 14.1.1 - '@next/swc-win32-x64-msvc': 14.1.1 + '@next/swc-darwin-arm64': 14.2.5 + '@next/swc-darwin-x64': 14.2.5 + '@next/swc-linux-arm64-gnu': 14.2.5 + '@next/swc-linux-arm64-musl': 14.2.5 + '@next/swc-linux-x64-gnu': 14.2.5 + '@next/swc-linux-x64-musl': 14.2.5 + '@next/swc-win32-arm64-msvc': 14.2.5 + '@next/swc-win32-ia32-msvc': 14.2.5 + '@next/swc-win32-x64-msvc': 14.2.5 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros optional: true - next@14.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@next/env': 14.1.1 - '@swc/helpers': 0.5.2 + '@next/env': 14.2.5 + '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001649 graceful-fs: 4.2.11 @@ -11635,15 +11639,15 @@ snapshots: react-dom: 18.3.1(react@18.3.1) styled-jsx: 5.1.1(react@18.3.1) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.1 - '@next/swc-darwin-x64': 14.1.1 - '@next/swc-linux-arm64-gnu': 14.1.1 - '@next/swc-linux-arm64-musl': 14.1.1 - '@next/swc-linux-x64-gnu': 14.1.1 - '@next/swc-linux-x64-musl': 14.1.1 - '@next/swc-win32-arm64-msvc': 14.1.1 - '@next/swc-win32-ia32-msvc': 14.1.1 - '@next/swc-win32-x64-msvc': 14.1.1 + '@next/swc-darwin-arm64': 14.2.5 + '@next/swc-darwin-x64': 14.2.5 + '@next/swc-linux-arm64-gnu': 14.2.5 + '@next/swc-linux-arm64-musl': 14.2.5 + '@next/swc-linux-x64-gnu': 14.2.5 + '@next/swc-linux-x64-musl': 14.2.5 + '@next/swc-win32-arm64-msvc': 14.2.5 + '@next/swc-win32-ia32-msvc': 14.2.5 + '@next/swc-win32-x64-msvc': 14.2.5 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros