@venlyfinance/react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,244 @@
1
+ import type { FundflowClient, VenlyFinanceClient } from "@venlyfinance/sdk";
2
+ import type { VenlyClients } from "./provider.js";
3
+ export type PartiesQuery = NonNullable<Parameters<VenlyFinanceClient["parties"]["list"]>[0]>;
4
+ export type AccountsQuery = NonNullable<Parameters<VenlyFinanceClient["accounts"]["list"]>[0]>;
5
+ export type WalletsQuery = NonNullable<Parameters<VenlyFinanceClient["wallets"]["list"]>[1]>;
6
+ export type VirtualBankAccountsQuery = NonNullable<Parameters<VenlyFinanceClient["virtualBankAccounts"]["list"]>[1]>;
7
+ export type TransfersQuery = NonNullable<Parameters<VenlyFinanceClient["transfers"]["list"]>[1]>;
8
+ export type RampRequestsQuery = NonNullable<Parameters<FundflowClient["rampRequests"]["list"]>[0]>;
9
+ export type FeeQuoteInput = Parameters<FundflowClient["fees"]["calculate"]>[0];
10
+ /**
11
+ * Pure `{ queryKey, queryFn }` factories, one per read. The hooks in
12
+ * queries.ts are one-line wrappers over these; anything that needs the same
13
+ * read outside React (prefetching, route loaders, tests) uses them directly.
14
+ */
15
+ export declare const venlyQueries: {
16
+ readonly parties: (clients: VenlyClients, query?: PartiesQuery) => {
17
+ queryKey: readonly ["venly", "parties", {} | null];
18
+ queryFn: () => Promise<import("@venlyfinance/sdk").Page<{
19
+ id?: string;
20
+ externalId?: string;
21
+ partyType?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["PartyType"];
22
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["PartyStatus"];
23
+ firstName?: string;
24
+ lastName?: string;
25
+ kycStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["KycStatus"];
26
+ name?: string;
27
+ vatNumber?: string;
28
+ kybStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["KybStatus"];
29
+ address?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["Address"];
30
+ createdAt?: string;
31
+ updatedAt?: string;
32
+ version?: number;
33
+ }>>;
34
+ };
35
+ readonly party: (clients: VenlyClients, partyId: string) => {
36
+ queryKey: readonly ["venly", "party", string];
37
+ queryFn: () => Promise<{
38
+ id?: string;
39
+ externalId?: string;
40
+ partyType?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["PartyType"];
41
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["PartyStatus"];
42
+ firstName?: string;
43
+ lastName?: string;
44
+ kycStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["KycStatus"];
45
+ name?: string;
46
+ vatNumber?: string;
47
+ kybStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["KybStatus"];
48
+ address?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["Address"];
49
+ createdAt?: string;
50
+ updatedAt?: string;
51
+ version?: number;
52
+ }>;
53
+ };
54
+ readonly accounts: (clients: VenlyClients, query?: AccountsQuery) => {
55
+ queryKey: readonly ["venly", "accounts", {} | null];
56
+ queryFn: () => Promise<import("@venlyfinance/sdk").Page<{
57
+ id?: string;
58
+ externalId?: string;
59
+ name?: string;
60
+ kycStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["KycStatus"];
61
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["AccountStatus"];
62
+ createdAt?: string;
63
+ version?: number;
64
+ }>>;
65
+ };
66
+ readonly account: (clients: VenlyClients, accountId: string) => {
67
+ queryKey: readonly ["venly", "account", string];
68
+ queryFn: () => Promise<{
69
+ id?: string;
70
+ externalId?: string;
71
+ name?: string;
72
+ kycStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["KycStatus"];
73
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["AccountStatus"];
74
+ createdAt?: string;
75
+ version?: number;
76
+ }>;
77
+ };
78
+ readonly wallets: (clients: VenlyClients, accountId: string, query?: WalletsQuery) => {
79
+ queryKey: readonly ["venly", "account", string, "wallets", {} | null];
80
+ queryFn: () => Promise<import("@venlyfinance/sdk").Page<{
81
+ id?: string;
82
+ chain?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["BlockchainNetwork"];
83
+ type?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["WalletType"];
84
+ address?: string;
85
+ balances?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["TokenBalance"][];
86
+ amlStatus?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["AmlStatus"];
87
+ }>>;
88
+ };
89
+ readonly virtualBankAccounts: (clients: VenlyClients, accountId: string, query?: VirtualBankAccountsQuery) => {
90
+ queryKey: readonly ["venly", "account", string, "virtual-bank-accounts", {} | null];
91
+ queryFn: () => Promise<import("@venlyfinance/sdk").Page<{
92
+ id?: string;
93
+ accountId?: string;
94
+ bankAccountType?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["BankAccountType"];
95
+ name?: string;
96
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["VirtualBankAccountStatus"];
97
+ currency?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["FiatCurrency"];
98
+ targetCryptocurrency?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["Cryptocurrency"];
99
+ iban?: string;
100
+ bic?: string;
101
+ bankName?: string;
102
+ beneficiaryName?: string;
103
+ referenceCode?: string;
104
+ createdAt?: string;
105
+ updatedAt?: string;
106
+ }>>;
107
+ };
108
+ readonly transfers: (clients: VenlyClients, accountId: string, query?: TransfersQuery) => {
109
+ queryKey: readonly ["venly", "account", string, "transfers", {} | null];
110
+ queryFn: () => Promise<import("@venlyfinance/sdk").Page<{
111
+ id?: string;
112
+ senderAccountId?: string;
113
+ receiverAccountId?: string;
114
+ chain?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["BlockchainNetwork"];
115
+ asset?: string;
116
+ amount?: number;
117
+ fiatOrigin?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["FiatOrigin"];
118
+ description?: string;
119
+ merchantReference?: string;
120
+ idempotencyKey?: string;
121
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["TransferStatus"];
122
+ transactionHash?: string;
123
+ errorMessage?: string;
124
+ createdAt?: string;
125
+ updatedAt?: string;
126
+ }>>;
127
+ };
128
+ readonly transfer: (clients: VenlyClients, accountId: string, transferId: string) => {
129
+ queryKey: readonly ["venly", "account", string, "transfer", string];
130
+ queryFn: () => Promise<{
131
+ id?: string;
132
+ senderAccountId?: string;
133
+ receiverAccountId?: string;
134
+ chain?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["BlockchainNetwork"];
135
+ asset?: string;
136
+ amount?: number;
137
+ fiatOrigin?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["FiatOrigin"];
138
+ description?: string;
139
+ merchantReference?: string;
140
+ idempotencyKey?: string;
141
+ status?: import("@venlyfinance/sdk").FinanceComponents["schemas"]["TransferStatus"];
142
+ transactionHash?: string;
143
+ errorMessage?: string;
144
+ createdAt?: string;
145
+ updatedAt?: string;
146
+ }>;
147
+ };
148
+ readonly rampRequests: (clients: VenlyClients, query?: RampRequestsQuery) => {
149
+ queryKey: readonly ["venly", "ramp-requests", {} | null];
150
+ queryFn: () => Promise<import("@venlyfinance/sdk").Page<{
151
+ id?: string;
152
+ paymentReference?: string;
153
+ rampType?: "ON_RAMP" | "OFF_RAMP";
154
+ status?: "AWAITING_APPROVAL" | "AWAITING_FUNDS" | "PROCESSING" | "SUCCEEDED" | "FAILED" | "BLOCKED" | "DENIED" | "REJECTED" | "CANCELLED";
155
+ fiatAmount?: number;
156
+ fiatCurrency?: string;
157
+ cryptoAmount?: number;
158
+ cryptoCurrency?: string;
159
+ createdAt?: string;
160
+ createdBy?: string;
161
+ }>>;
162
+ };
163
+ readonly rampRequest: (clients: VenlyClients, id: string) => {
164
+ queryKey: readonly ["venly", "ramp-request", string];
165
+ queryFn: () => Promise<{
166
+ id?: string;
167
+ companyId?: string;
168
+ companyName?: string;
169
+ rampType?: "ON_RAMP" | "OFF_RAMP";
170
+ status?: "AWAITING_APPROVAL" | "AWAITING_FUNDS" | "PROCESSING" | "SUCCEEDED" | "FAILED" | "BLOCKED" | "DENIED" | "REJECTED" | "CANCELLED";
171
+ amount?: number;
172
+ netAmount?: number;
173
+ fiatAmount?: number;
174
+ fiatNetAmount?: number;
175
+ cryptoAmount?: number;
176
+ fiatFeeAmount?: number;
177
+ exchangeRate?: number;
178
+ feePercentage?: number;
179
+ paymentReference?: string;
180
+ paymentReceived?: boolean;
181
+ blockchainTransactionHash?: string;
182
+ createdAt?: string;
183
+ companyBankAccount?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["EurSepaCompanyBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["GbpChapsCompanyBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["GbpFpsCompanyBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["OtherCurrencySwiftCompanyBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["UsAchCompanyBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["UsSwiftCompanyBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["UsWireCompanyBankAccountDto"];
184
+ companyWallet?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["CompanyWalletDto"];
185
+ depositBankAccount?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["EurSepaDepositBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["GbpChapsDepositBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["GbpFpsDepositBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["OtherCurrencySwiftDepositBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["UsAchDepositBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["UsSwiftDepositBankAccountDto"] | import("@venlyfinance/sdk").FundflowComponents["schemas"]["UsWireDepositBankAccountDto"];
186
+ depositWallet?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["DepositWalletDto"];
187
+ fiatCurrency?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["FiatCurrencyDto"];
188
+ cryptoCurrency?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["CryptoCurrencyDto"];
189
+ events?: import("@venlyfinance/sdk").FundflowComponents["schemas"]["RampRequestEventDto"][];
190
+ version?: number;
191
+ amountReceived?: number;
192
+ }>;
193
+ };
194
+ /** Chains + fiat + crypto currencies in one cacheable read. */
195
+ readonly referenceData: (clients: VenlyClients) => {
196
+ queryKey: readonly ["venly", "reference-data"];
197
+ queryFn: () => Promise<{
198
+ fiatCurrencies: {
199
+ id?: string;
200
+ currency?: string;
201
+ label?: string;
202
+ enabled?: boolean;
203
+ version?: number;
204
+ }[];
205
+ cryptoCurrencies: {
206
+ id?: string;
207
+ currency?: string;
208
+ chain?: "ETHEREUM" | "POLYGON" | "BASE" | "ARBITRUM" | "SUI";
209
+ label?: string;
210
+ enabled?: boolean;
211
+ version?: number;
212
+ coingeckoId?: string;
213
+ }[];
214
+ chains: {
215
+ supportedChains?: ("ETHEREUM" | "POLYGON" | "BASE" | "ARBITRUM" | "SUI")[];
216
+ }[];
217
+ }>;
218
+ };
219
+ readonly companyFees: (clients: VenlyClients) => {
220
+ queryKey: readonly ["venly", "company-fees"];
221
+ queryFn: () => Promise<{
222
+ id?: string;
223
+ companyId?: string;
224
+ name?: string;
225
+ type?: "ON_RAMP" | "OFF_RAMP";
226
+ minVolume?: number;
227
+ maxVolume?: number;
228
+ percentage?: number;
229
+ version?: number;
230
+ }[]>;
231
+ };
232
+ /**
233
+ * Fee calculation is a POST but semantically a pure function of its input,
234
+ * so it is modelled as a query keyed by the input: same input, cached
235
+ * answer; new input, new fetch.
236
+ */
237
+ readonly feeQuote: (clients: VenlyClients, input: FeeQuoteInput) => {
238
+ queryKey: readonly ["venly", "fee-quote", unknown];
239
+ queryFn: () => Promise<{
240
+ amount?: number;
241
+ percentage?: number;
242
+ }>;
243
+ };
244
+ };
@@ -0,0 +1,73 @@
1
+ import { venlyKeys } from "./keys.js";
2
+ /**
3
+ * Pure `{ queryKey, queryFn }` factories, one per read. The hooks in
4
+ * queries.ts are one-line wrappers over these; anything that needs the same
5
+ * read outside React (prefetching, route loaders, tests) uses them directly.
6
+ */
7
+ export const venlyQueries = {
8
+ parties: (clients, query) => ({
9
+ queryKey: venlyKeys.parties(query),
10
+ queryFn: () => clients.finance.parties.list(query),
11
+ }),
12
+ party: (clients, partyId) => ({
13
+ queryKey: venlyKeys.party(partyId),
14
+ queryFn: () => clients.finance.parties.get(partyId),
15
+ }),
16
+ accounts: (clients, query) => ({
17
+ queryKey: venlyKeys.accounts(query),
18
+ queryFn: () => clients.finance.accounts.list(query),
19
+ }),
20
+ account: (clients, accountId) => ({
21
+ queryKey: venlyKeys.account(accountId),
22
+ queryFn: () => clients.finance.accounts.get(accountId),
23
+ }),
24
+ wallets: (clients, accountId, query) => ({
25
+ queryKey: venlyKeys.wallets(accountId, query),
26
+ queryFn: () => clients.finance.wallets.list(accountId, query),
27
+ }),
28
+ virtualBankAccounts: (clients, accountId, query) => ({
29
+ queryKey: venlyKeys.virtualBankAccounts(accountId, query),
30
+ queryFn: () => clients.finance.virtualBankAccounts.list(accountId, query),
31
+ }),
32
+ transfers: (clients, accountId, query) => ({
33
+ queryKey: venlyKeys.transfers(accountId, query),
34
+ queryFn: () => clients.finance.transfers.list(accountId, query),
35
+ }),
36
+ transfer: (clients, accountId, transferId) => ({
37
+ queryKey: venlyKeys.transfer(accountId, transferId),
38
+ queryFn: () => clients.finance.transfers.get(accountId, transferId),
39
+ }),
40
+ rampRequests: (clients, query) => ({
41
+ queryKey: venlyKeys.rampRequests(query),
42
+ queryFn: () => clients.fundflow.rampRequests.list(query),
43
+ }),
44
+ rampRequest: (clients, id) => ({
45
+ queryKey: venlyKeys.rampRequest(id),
46
+ queryFn: () => clients.fundflow.rampRequests.get(id),
47
+ }),
48
+ /** Chains + fiat + crypto currencies in one cacheable read. */
49
+ referenceData: (clients) => ({
50
+ queryKey: venlyKeys.referenceData(),
51
+ queryFn: async () => {
52
+ const [fiatCurrencies, cryptoCurrencies, chains] = await Promise.all([
53
+ clients.fundflow.referenceData.fiatCurrencies(),
54
+ clients.fundflow.referenceData.cryptoCurrencies(),
55
+ clients.fundflow.referenceData.chains(),
56
+ ]);
57
+ return { fiatCurrencies, cryptoCurrencies, chains };
58
+ },
59
+ }),
60
+ companyFees: (clients) => ({
61
+ queryKey: venlyKeys.companyFees(),
62
+ queryFn: () => clients.fundflow.fees.listCompanyFees(),
63
+ }),
64
+ /**
65
+ * Fee calculation is a POST but semantically a pure function of its input,
66
+ * so it is modelled as a query keyed by the input: same input, cached
67
+ * answer; new input, new fetch.
68
+ */
69
+ feeQuote: (clients, input) => ({
70
+ queryKey: venlyKeys.feeQuote(input),
71
+ queryFn: () => clients.fundflow.fees.calculate(input),
72
+ }),
73
+ };
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@venlyfinance/react",
3
+ "version": "0.1.0",
4
+ "description": "Headless React layer for the Venly Finance and Fundflow APIs: provider, TanStack Query hooks, and flow state machines for regulated money movement. Runs with zero credentials in mock mode.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist",
18
+ "LICENSE",
19
+ "README.md",
20
+ "CHANGELOG.md",
21
+ "AGENTS.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "rm -rf dist && tsc -p tsconfig.json",
25
+ "test": "node --import tsx --test test/*.test.ts",
26
+ "typecheck": "tsc -p tsconfig.json --noEmit",
27
+ "typecheck:test": "tsc -p tsconfig.test.json"
28
+ },
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
32
+ "dependencies": {
33
+ "@venlyfinance/sdk": "^0.2.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@tanstack/react-query": "^5.0.0",
37
+ "react": "^18.0.0 || ^19.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@tanstack/react-query": "^5.62.0",
41
+ "@types/node": "^22.10.0",
42
+ "@types/react": "^19.0.0",
43
+ "@types/react-dom": "^19.2.4",
44
+ "react": "^19.0.0",
45
+ "react-dom": "^19.0.0",
46
+ "tsx": "^4.19.2",
47
+ "typescript": "^5.7.2"
48
+ },
49
+ "keywords": [
50
+ "venly",
51
+ "react",
52
+ "hooks",
53
+ "stablecoin",
54
+ "settlement",
55
+ "payments",
56
+ "headless"
57
+ ],
58
+ "license": "MIT",
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/Venly/venly-settlement-sdk.git",
62
+ "directory": "react"
63
+ },
64
+ "homepage": "https://github.com/Venly/venly-settlement-sdk/tree/main/react#readme"
65
+ }