@spritz-finance/api-client 0.4.19 → 0.4.21
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.
- package/README.md +51 -33
- package/dist/spritz-api-client.cjs +14 -8
- package/dist/spritz-api-client.d.ts +14 -2
- package/dist/spritz-api-client.mjs +14 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -237,51 +237,68 @@ All users must undergo basic identity verification before they can engage with t
|
|
|
237
237
|
|
|
238
238
|
### How to Present Verification Flow to the User
|
|
239
239
|
|
|
240
|
-
Spritz offers two methods for integrating KYC verification:
|
|
240
|
+
Spritz offers two methods for integrating KYC verification, both using the `getVerificationParams()` method:
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
```typescript
|
|
243
|
+
// Get verification parameters from Spritz
|
|
244
|
+
const verificationParams = await client.user.getVerificationParams()
|
|
245
|
+
|
|
246
|
+
// The response includes:
|
|
247
|
+
// - inquiryId: Unique identifier for this verification inquiry
|
|
248
|
+
// - verificationUrl: URL for hosted verification
|
|
249
|
+
// - sessionToken: Token for use with Plaid Link SDK
|
|
250
|
+
// - verificationUrlExpiresAt: Expiration timestamp for the verification URL
|
|
251
|
+
```
|
|
243
252
|
|
|
244
|
-
|
|
253
|
+
#### Method 1: Verification URL (Simple Integration)
|
|
245
254
|
|
|
246
|
-
|
|
247
|
-
- **In-App**: Embed the URL in an iframe within your application.
|
|
248
|
-
- **Mobile**: If your platform is mobile-based, open the URL in a native mobile web view.
|
|
249
|
-
- **Email**: Send users an email containing the link, prompting them to complete the identity verification.
|
|
255
|
+
Use the `verificationUrl` from `getVerificationParams()` for a straightforward integration where Spritz handles the entire verification flow:
|
|
250
256
|
|
|
251
257
|
```typescript
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
//
|
|
260
|
-
|
|
258
|
+
const verificationParams = await client.user.getVerificationParams()
|
|
259
|
+
const verificationUrl = verificationParams.verificationUrl
|
|
260
|
+
const expiresAt = verificationParams.verificationUrlExpiresAt
|
|
261
|
+
|
|
262
|
+
// Important: The verification URL is short-lived and single-use
|
|
263
|
+
// - Check the expiration with verificationUrlExpiresAt before using
|
|
264
|
+
// - Once accessed, the URL becomes invalid
|
|
265
|
+
// - If verification is not completed, call getVerificationParams() again for a new URL
|
|
266
|
+
|
|
267
|
+
// Use the verification URL in your application:
|
|
268
|
+
// - Browser: Open the URL in a new browser tab
|
|
269
|
+
// - In-App: Embed the URL in an iframe within your application
|
|
270
|
+
// - Mobile: Open the URL in a native mobile web view
|
|
271
|
+
// - Email: Send users an email containing the link
|
|
261
272
|
```
|
|
262
273
|
|
|
263
|
-
|
|
274
|
+
**Note**: The verification URL can only be used once. If the user doesn't complete verification after accessing the URL, you'll need to call `getVerificationParams()` again to generate a fresh URL and session.
|
|
275
|
+
|
|
276
|
+
#### Method 2: Embedded Flow (Advanced Integration)
|
|
264
277
|
|
|
265
|
-
For more control over the verification experience, use the
|
|
278
|
+
For more control over the verification experience, use the `inquiryId` and `sessionToken` (if present) from `getVerificationParams()` with the Persona Embedded Flow:
|
|
266
279
|
|
|
267
280
|
```typescript
|
|
268
|
-
|
|
269
|
-
const
|
|
281
|
+
const verificationParams = await client.user.getVerificationParams()
|
|
282
|
+
const inquiryId = verificationParams.inquiryId
|
|
283
|
+
const sessionToken = verificationParams.sessionToken // May be null for some flows
|
|
270
284
|
|
|
271
|
-
// Use the
|
|
285
|
+
// Use the inquiryId (and sessionToken if present) with Persona's Embedded Flow
|
|
286
|
+
// to create a custom verification experience
|
|
272
287
|
// This allows you to:
|
|
273
288
|
// - Customize the UI/UX of the verification process
|
|
274
289
|
// - Handle callbacks and events directly
|
|
275
290
|
// - Integrate verification seamlessly into your application flow
|
|
291
|
+
// - Build a native mobile experience using Persona's mobile SDKs
|
|
276
292
|
```
|
|
277
293
|
|
|
278
|
-
The
|
|
294
|
+
The embedded flow method is ideal when you want to:
|
|
295
|
+
|
|
279
296
|
- Maintain full control over the user experience
|
|
280
297
|
- Integrate verification directly into your app without redirects
|
|
281
298
|
- Handle verification events and callbacks programmatically
|
|
282
|
-
-
|
|
299
|
+
- Track and resume verification sessions with the inquiryId
|
|
283
300
|
|
|
284
|
-
See the [
|
|
301
|
+
See the [Persona Embedded Flow documentation](https://docs.withpersona.com/quickstart-embedded-flow) for detailed integration instructions with the inquiryId and sessionToken.
|
|
285
302
|
|
|
286
303
|
### Verification Metadata (Failed Verifications)
|
|
287
304
|
|
|
@@ -1210,6 +1227,7 @@ The on-ramp feature allows users to purchase cryptocurrency using traditional pa
|
|
|
1210
1227
|
### Prerequisites
|
|
1211
1228
|
|
|
1212
1229
|
Before a user can on-ramp, they must:
|
|
1230
|
+
|
|
1213
1231
|
1. Complete platform-level KYC (identity verification)
|
|
1214
1232
|
2. Accept the third-party on-ramp provider's Terms of Service
|
|
1215
1233
|
3. Wait for the provider's KYC to process (happens automatically after accepting ToS)
|
|
@@ -1228,7 +1246,7 @@ if (accessCapabilities.capabilities.onramp.active) {
|
|
|
1228
1246
|
// Features may include: 'ach_purchase', 'wire_purchase'
|
|
1229
1247
|
} else {
|
|
1230
1248
|
console.log('User needs to complete requirements:')
|
|
1231
|
-
accessCapabilities.capabilities.onramp.requirements.forEach(req => {
|
|
1249
|
+
accessCapabilities.capabilities.onramp.requirements.forEach((req) => {
|
|
1232
1250
|
console.log(`- ${req.type}: ${req.description}`)
|
|
1233
1251
|
if (req.actionUrl) {
|
|
1234
1252
|
console.log(` Action URL: ${req.actionUrl}`)
|
|
@@ -1269,7 +1287,7 @@ const access = await client.user.getUserAccess()
|
|
|
1269
1287
|
|
|
1270
1288
|
// Find the Terms of Service requirement
|
|
1271
1289
|
const tosRequirement = access.capabilities.onramp.requirements.find(
|
|
1272
|
-
req => req.type === 'terms_acceptance'
|
|
1290
|
+
(req) => req.type === 'terms_acceptance'
|
|
1273
1291
|
)
|
|
1274
1292
|
|
|
1275
1293
|
if (tosRequirement && tosRequirement.actionUrl) {
|
|
@@ -1301,7 +1319,7 @@ const access = await client.user.getUserAccess()
|
|
|
1301
1319
|
|
|
1302
1320
|
// Check provider KYC status (for monitoring only)
|
|
1303
1321
|
const kycRequirement = access.capabilities.onramp.requirements.find(
|
|
1304
|
-
req => req.type === 'identity_verification'
|
|
1322
|
+
(req) => req.type === 'identity_verification'
|
|
1305
1323
|
)
|
|
1306
1324
|
|
|
1307
1325
|
if (kycRequirement) {
|
|
@@ -1327,7 +1345,7 @@ Use webhooks to be notified when user capabilities change:
|
|
|
1327
1345
|
// Set up a webhook to monitor capability updates
|
|
1328
1346
|
const webhook = await client.webhook.create({
|
|
1329
1347
|
url: 'https://your-server.com/webhook',
|
|
1330
|
-
events: ['capabilities.updated']
|
|
1348
|
+
events: ['capabilities.updated'],
|
|
1331
1349
|
})
|
|
1332
1350
|
|
|
1333
1351
|
// In your webhook handler:
|
|
@@ -1354,7 +1372,7 @@ console.log('Supported tokens on Ethereum:', supportedTokens)
|
|
|
1354
1372
|
const virtualAccount = await client.virtualAccounts.create({
|
|
1355
1373
|
network: PaymentNetwork.Ethereum,
|
|
1356
1374
|
address: '0xYourEthereumAddress',
|
|
1357
|
-
token: 'USDC'
|
|
1375
|
+
token: 'USDC',
|
|
1358
1376
|
})
|
|
1359
1377
|
|
|
1360
1378
|
// The virtual account includes deposit instructions
|
|
@@ -1374,7 +1392,7 @@ if (virtualAccount.depositInstructions) {
|
|
|
1374
1392
|
// Get all virtual accounts for the user
|
|
1375
1393
|
const accounts = await client.virtualAccounts.list()
|
|
1376
1394
|
|
|
1377
|
-
accounts.forEach(account => {
|
|
1395
|
+
accounts.forEach((account) => {
|
|
1378
1396
|
console.log(`Network: ${account.network}`)
|
|
1379
1397
|
console.log(`Address: ${account.address}`)
|
|
1380
1398
|
console.log(`Token: ${account.token}`)
|
|
@@ -1406,7 +1424,7 @@ import { SpritzApiClient, Environment, PaymentNetwork } from '@spritz-finance/ap
|
|
|
1406
1424
|
|
|
1407
1425
|
const client = SpritzApiClient.initialize({
|
|
1408
1426
|
environment: Environment.Production,
|
|
1409
|
-
integrationKey: 'YOUR_INTEGRATION_KEY'
|
|
1427
|
+
integrationKey: 'YOUR_INTEGRATION_KEY',
|
|
1410
1428
|
})
|
|
1411
1429
|
|
|
1412
1430
|
// Set user API key
|
|
@@ -1435,7 +1453,7 @@ async function setupOnramp() {
|
|
|
1435
1453
|
const virtualAccount = await client.virtualAccounts.create({
|
|
1436
1454
|
network: PaymentNetwork.Ethereum,
|
|
1437
1455
|
address: '0xUserWalletAddress',
|
|
1438
|
-
token: 'USDC'
|
|
1456
|
+
token: 'USDC',
|
|
1439
1457
|
})
|
|
1440
1458
|
|
|
1441
1459
|
console.log('Virtual account created!')
|
|
@@ -1444,7 +1462,7 @@ async function setupOnramp() {
|
|
|
1444
1462
|
return true
|
|
1445
1463
|
}
|
|
1446
1464
|
|
|
1447
|
-
setupOnramp().then(success => {
|
|
1465
|
+
setupOnramp().then((success) => {
|
|
1448
1466
|
if (success) {
|
|
1449
1467
|
console.log('On-ramp setup complete!')
|
|
1450
1468
|
}
|
|
@@ -411,7 +411,7 @@ query VirtualAccounts {
|
|
|
411
411
|
virtualAccounts {
|
|
412
412
|
...VirtualAccountFragment
|
|
413
413
|
}
|
|
414
|
-
}`,name:"GraphQL request",locationOffset:{line:1,column:1}};var f4={};function jE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return f4[t]?!1:(f4[t]=!0,!0)})}ht.definitions=ht.definitions.concat(jE(oi.definitions));function ju(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){ju(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){ju(u,n)}),e.definitions&&e.definitions.forEach(function(u){ju(u,n)})}var fs={};(function(){ht.definitions.forEach(function(n){if(n.name){var t=new Set;ju(n,t),fs[n.name.value]=t}})})();function m4(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function LE(e,n){var t={kind:e.kind,definitions:[m4(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=m4(e,o);s&&t.definitions.push(s)}),t}LE(ht,"VirtualAccounts");var Me=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(Me||{});const v4={[Me.Ethereum]:["USDC","USDT","DAI","USDP","PYUSD"],[Me.Polygon]:["USDC"],[Me.Base]:["USDC"],[Me.Arbitrum]:["USDC"],[Me.Avalanche]:["USDC"],[Me.Optimism]:["USDC"],[Me.Solana]:["USDC","PYUSD"],[Me.Tron]:["USDT"]};function ZE(e){const{network:n,token:t}=e,u=v4[n];if(!u||!u.includes(t))throw new Error(`Token "${t}" is not supported on network "${n}". Supported tokens for ${n}: ${u?.join(", ")||"none"}`)}class VE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:ht})).virtualAccounts}async create(n){return ZE(n),(await this.client.query({query:pt,variables:{network:n.network,address:n.address,token:n.token}})).createVirtualAccount}}var gt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"paymentRequestId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyRate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"transaction"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hash"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"from"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"asset"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:
|
|
414
|
+
}`,name:"GraphQL request",locationOffset:{line:1,column:1}};var f4={};function jE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return f4[t]?!1:(f4[t]=!0,!0)})}ht.definitions=ht.definitions.concat(jE(oi.definitions));function ju(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){ju(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){ju(u,n)}),e.definitions&&e.definitions.forEach(function(u){ju(u,n)})}var fs={};(function(){ht.definitions.forEach(function(n){if(n.name){var t=new Set;ju(n,t),fs[n.name.value]=t}})})();function m4(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function LE(e,n){var t={kind:e.kind,definitions:[m4(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=m4(e,o);s&&t.definitions.push(s)}),t}LE(ht,"VirtualAccounts");var Me=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(Me||{});const v4={[Me.Ethereum]:["USDC","USDT","DAI","USDP","PYUSD"],[Me.Polygon]:["USDC"],[Me.Base]:["USDC"],[Me.Arbitrum]:["USDC"],[Me.Avalanche]:["USDC"],[Me.Optimism]:["USDC"],[Me.Solana]:["USDC","PYUSD"],[Me.Tron]:["USDT"]};function ZE(e){const{network:n,token:t}=e,u=v4[n];if(!u||!u.includes(t))throw new Error(`Token "${t}" is not supported on network "${n}". Supported tokens for ${n}: ${u?.join(", ")||"none"}`)}class VE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:ht})).virtualAccounts}async create(n){return ZE(n),(await this.client.query({query:pt,variables:{network:n.network,address:n.address,token:n.token}})).createVirtualAccount}}var gt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"paymentRequestId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyRate"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"failureReason"},name:{kind:"Name",value:"error"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"transaction"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hash"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"from"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"asset"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:348}};gt.loc.source={body:`fragment PaymentFragment on Payment {
|
|
415
415
|
id
|
|
416
416
|
userId
|
|
417
417
|
status
|
|
@@ -424,6 +424,7 @@ query VirtualAccounts {
|
|
|
424
424
|
targetCurrency
|
|
425
425
|
targetCurrencyAmount
|
|
426
426
|
targetCurrencyRate
|
|
427
|
+
failureReason: error
|
|
427
428
|
transaction {
|
|
428
429
|
hash
|
|
429
430
|
from
|
|
@@ -529,10 +530,7 @@ mutation CreatePaymentRequest($createDirectPaymentInput: CreateDirectPaymentInpu
|
|
|
529
530
|
*/var vb="0.1.1";function pb(){return vb}var Te=class rc extends Error{constructor(n,t={}){const u=(()=>{if(t.cause instanceof rc){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&typeof t.cause.details=="string"?t.cause.details:t.cause?.message?t.cause.message:t.details})(),i=t.cause instanceof rc&&t.cause.docsPath||t.docsPath,a=`https://oxlib.sh${i??""}`,o=[n||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...u||i?["",u?`Details: ${u}`:void 0,i?`See: ${a}`:void 0]:[]].filter(s=>typeof s=="string").join(`
|
|
530
531
|
`);super(o,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${pb()}`}),this.cause=t.cause,this.details=u,this.docs=a,this.docsPath=i,this.shortMessage=n}walk(n){return gv(this,n)}};function gv(e,n){return n?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?gv(e.cause,n):n?null:e}function hb(e,n){if(bv(e)>n)throw new Bb({givenSize:bv(e),maxSize:n})}var tn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ev(e){if(e>=tn.zero&&e<=tn.nine)return e-tn.zero;if(e>=tn.A&&e<=tn.F)return e-(tn.A-10);if(e>=tn.a&&e<=tn.f)return e-(tn.a-10)}function gb(e,n={}){const{dir:t,size:u=32}=n;if(u===0)return e;if(e.length>u)throw new wb({size:e.length,targetSize:u,type:"Bytes"});const i=new Uint8Array(u);for(let r=0;r<u;r++){const a=t==="right";i[a?r:u-r-1]=e[a?r:e.length-r-1]}return i}function Ps(e,n){if(js(e)>n)throw new Ib({givenSize:js(e),maxSize:n})}function yv(e,n={}){const{dir:t,size:u=32}=n;if(u===0)return e;const i=e.replace("0x","");if(i.length>u*2)throw new Nb({size:Math.ceil(i.length/2),targetSize:u,type:"Hex"});return`0x${i[t==="right"?"padEnd":"padStart"](u*2,"0")}`}new TextDecoder;var Eb=new TextEncoder;function yb(e){return e instanceof Uint8Array?e:typeof e=="string"?kb(e):bb(e)}function bb(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function kb(e,n={}){const{size:t}=n;let u=e;t&&(Ps(e,t),u=Rs(e,t));let i=u.slice(2);i.length%2&&(i=`0${i}`);const r=i.length/2,a=new Uint8Array(r);for(let o=0,s=0;o<r;o++){const c=Ev(i.charCodeAt(s++)),l=Ev(i.charCodeAt(s++));if(c===void 0||l===void 0)throw new Te(`Invalid byte sequence ("${i[s-2]}${i[s-1]}" in "${i}").`);a[o]=c*16+l}return a}function Db(e,n={}){const{size:t}=n,u=Eb.encode(e);return typeof t=="number"?(hb(u,t),Sb(u,t)):u}function Sb(e,n){return gb(e,{dir:"right",size:n})}function bv(e){return e.length}var Bb=class extends Te{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},wb=class extends Te{constructor({size:e,targetSize:n,type:t}){super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}},Ab=new TextEncoder,_b=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function kv(...e){return`0x${e.reduce((n,t)=>n+t.replace("0x",""),"")}`}function Cb(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(Ps(t,n.size),hr(t,n.size)):t}function Dv(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=_b[e[i]];const u=`0x${t}`;return typeof n.size=="number"?(Ps(u,n.size),Rs(u,n.size)):u}function $b(e,n={}){const{signed:t,size:u}=n,i=BigInt(e);let r;u?t?r=(1n<<BigInt(u)*8n-1n)-1n:r=2n**(BigInt(u)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&t?-r-1n:0;if(r&&i>r||i<a){const c=typeof e=="bigint"?"n":"";throw new xb({max:r?`${r}${c}`:void 0,min:`${a}${c}`,signed:t,size:u,value:`${e}${c}`})}const s=`0x${(t&&i<0?(1n<<BigInt(u*8))+BigInt(i):i).toString(16)}`;return u?hr(s,u):s}function Fb(e,n={}){return Dv(Ab.encode(e),n)}function hr(e,n){return yv(e,{dir:"left",size:n})}function Rs(e,n){return yv(e,{dir:"right",size:n})}function js(e){return Math.ceil((e.length-2)/2)}var xb=class extends Te{constructor({max:e,min:n,signed:t,size:u,value:i}){super(`Number \`${i}\` is not in safe${u?` ${u*8}-bit`:""}${t?" signed":" unsigned"} integer range ${e?`(\`${n}\` to \`${e}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Ib=class extends Te{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},Nb=class extends Te{constructor({size:e,targetSize:n,type:t}){super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}},Sv="2.31.7",Ls={getDocsUrl:({docsBaseUrl:e,docsPath:n="",docsSlug:t})=>n?`${e??"https://viem.sh"}${n}${t?`#${t}`:""}`:void 0,version:`viem@${Sv}`},gr=class ac extends Error{constructor(n,t={}){const u=t.cause instanceof ac?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof ac&&t.cause.docsPath||t.docsPath,r=Ls.getDocsUrl?.({...t,docsPath:i}),a=[n||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...u?[`Details: ${u}`]:[],...Ls.version?[`Version: ${Ls.version}`]:[]].join(`
|
|
531
532
|
`);super(a,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=u,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=n,this.version=Sv}walk(n){return Bv(this,n)}};function Bv(e,n){return n?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Bv(e.cause,n):n?null:e}function Zs(e,{strict:n=!0}={}){return!e||typeof e!="string"?!1:n?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function wv(e){return Zs(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Av=class extends gr{constructor({size:e,targetSize:n,type:t}){super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function Er(e,{dir:n,size:t=32}={}){return typeof e=="string"?Tb(e,{dir:n,size:t}):Ob(e,{dir:n,size:t})}function Tb(e,{dir:n,size:t=32}={}){if(t===null)return e;const u=e.replace("0x","");if(u.length>t*2)throw new Av({size:Math.ceil(u.length/2),targetSize:t,type:"hex"});return`0x${u[n==="right"?"padEnd":"padStart"](t*2,"0")}`}function Ob(e,{dir:n,size:t=32}={}){if(t===null)return e;if(e.length>t)throw new Av({size:e.length,targetSize:t,type:"bytes"});const u=new Uint8Array(t);for(let i=0;i<t;i++){const r=n==="right";u[r?i:t-i-1]=e[r?i:e.length-i-1]}return u}var zb=class extends gr{constructor({max:e,min:n,signed:t,size:u,value:i}){super(`Number "${i}" is not in safe ${u?`${u*8}-bit ${t?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},Ub=class extends gr{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function yr(e,{size:n}){if(wv(e)>n)throw new Ub({givenSize:wv(e),maxSize:n})}function Pb(e,n={}){const{signed:t}=n;n.size&&yr(e,{size:n.size});const u=BigInt(e);if(!t)return u;const i=(e.length-2)/2,r=(1n<<BigInt(i)*8n-1n)-1n;return u<=r?u:u-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Rb(e,n={}){return Number(Pb(e,n))}Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function Vs(e,n={}){const{signed:t,size:u}=n,i=BigInt(e);let r;u?t?r=(1n<<BigInt(u)*8n-1n)-1n:r=2n**(BigInt(u)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&t?-r-1n:0;if(r&&i>r||i<a){const s=typeof e=="bigint"?"n":"";throw new zb({max:r?`${r}${s}`:void 0,min:`${a}${s}`,signed:t,size:u,value:`${e}${s}`})}const o=`0x${(t&&i<0?(1n<<BigInt(u*8))+BigInt(i):i).toString(16)}`;return u?Er(o,{size:u}):o}new TextEncoder;var jb=new TextEncoder;function Lb(e,n={}){return typeof e=="number"||typeof e=="bigint"?Vb(e,n):typeof e=="boolean"?Zb(e,n):Zs(e)?Cv(e,n):$v(e,n)}function Zb(e,n={}){const t=new Uint8Array(1);return t[0]=Number(e),typeof n.size=="number"?(yr(t,{size:n.size}),Er(t,{size:n.size})):t}var un={zero:48,nine:57,A:65,F:70,a:97,f:102};function _v(e){if(e>=un.zero&&e<=un.nine)return e-un.zero;if(e>=un.A&&e<=un.F)return e-(un.A-10);if(e>=un.a&&e<=un.f)return e-(un.a-10)}function Cv(e,n={}){let t=e;n.size&&(yr(t,{size:n.size}),t=Er(t,{dir:"right",size:n.size}));let u=t.slice(2);u.length%2&&(u=`0${u}`);const i=u.length/2,r=new Uint8Array(i);for(let a=0,o=0;a<i;a++){const s=_v(u.charCodeAt(o++)),c=_v(u.charCodeAt(o++));if(s===void 0||c===void 0)throw new gr(`Invalid byte sequence ("${u[o-2]}${u[o-1]}" in "${u}").`);r[a]=s*16+c}return r}function Vb(e,n){const t=Vs(e,n);return Cv(t)}function $v(e,n={}){const t=jb.encode(e);return typeof n.size=="number"?(yr(t,{size:n.size}),Er(t,{dir:"right",size:n.size})):t}var qb=BigInt(0),hi=BigInt(1),Mb=BigInt(2),Gb=BigInt(7),Jb=BigInt(256),Qb=BigInt(113),Fv=[],xv=[],Iv=[];for(let e=0,n=hi,t=1,u=0;e<24;e++){[t,u]=[u,(2*t+3*u)%5],Fv.push(2*(5*u+t)),xv.push((e+1)*(e+2)/2%64);let i=qb;for(let r=0;r<7;r++)n=(n<<hi^(n>>Gb)*Qb)%Jb,n&Mb&&(i^=hi<<(hi<<BigInt(r))-hi);Iv.push(i)}var Nv=P4(Iv,!0),Hb=Nv[0],Kb=Nv[1],Tv=(e,n,t)=>t>32?hy(e,n,t):vy(e,n,t),Ov=(e,n,t)=>t>32?gy(e,n,t):py(e,n,t);function Wb(e,n=24){const t=new Uint32Array(10);for(let u=24-n;u<24;u++){for(let a=0;a<10;a++)t[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,s=(a+2)%10,c=t[s],l=t[s+1],f=Tv(c,l,1)^t[o],m=Ov(c,l,1)^t[o+1];for(let d=0;d<50;d+=10)e[a+d]^=f,e[a+d+1]^=m}let i=e[2],r=e[3];for(let a=0;a<24;a++){const o=xv[a],s=Tv(i,r,o),c=Ov(i,r,o),l=Fv[a];i=e[l],r=e[l+1],e[l]=s,e[l+1]=c}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)t[o]=e[a+o];for(let o=0;o<10;o++)e[a+o]^=~t[(o+2)%10]&t[(o+4)%10]}e[0]^=Hb[u],e[1]^=Kb[u]}Be(t)}var zv=class mp extends Ss{constructor(n,t,u,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=n,this.suffix=t,this.outputLen=u,this.enableXOF=i,this.rounds=r,si(u),!(0<n&&n<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=uy(this.state)}clone(){return this._cloneInto()}keccak(){C4(this.state32),Wb(this.state32,this.rounds),C4(this.state32),this.posOut=0,this.pos=0}update(n){St(this),n=li(n),fe(n);const{blockLen:t,state:u}=this,i=n.length;for(let r=0;r<i;){const a=Math.min(t-this.pos,i-r);for(let o=0;o<a;o++)u[this.pos++]^=n[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:n,suffix:t,pos:u,blockLen:i}=this;n[u]^=t,(t&128)!==0&&u===i-1&&this.keccak(),n[i-1]^=128,this.keccak()}writeInto(n){St(this,!1),fe(n),this.finish();const t=this.state,{blockLen:u}=this;for(let i=0,r=n.length;i<r;){this.posOut>=u&&this.keccak();const a=Math.min(u-this.posOut,r-i);n.set(t.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return n}xofInto(n){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(n)}xof(n){return si(n),this.xofInto(new Uint8Array(n))}digestInto(n){if(_4(n,this),this.finished)throw new Error("digest() was already called");return this.writeInto(n),this.destroy(),n}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Be(this.state)}_cloneInto(n){const{blockLen:t,suffix:u,outputLen:i,rounds:r,enableXOF:a}=this;return n||(n=new mp(t,u,i,a,r)),n.state32.set(this.state32),n.pos=this.pos,n.posOut=this.posOut,n.finished=this.finished,n.rounds=r,n.suffix=u,n.outputLen=i,n.enableXOF=a,n.destroyed=this.destroyed,n}},yn=(e,n,t)=>Je(()=>new zv(n,e,t));yn(6,144,224/8),yn(6,136,256/8),yn(6,104,384/8),yn(6,72,512/8),yn(1,144,224/8);var Uv=yn(1,136,256/8);yn(1,104,384/8),yn(1,72,512/8);var Pv=(e,n,t)=>cy((u={})=>new zv(n,e,u.dkLen===void 0?t:u.dkLen,!0));Pv(31,168,128/8),Pv(31,136,256/8);function Yb(e,n){return Uv(Zs(e,{strict:!1})?Lb(e):e)}var gi=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const t=this.keys().next().value;t&&this.delete(t)}return this}},Xb=/^0x[a-fA-F0-9]{40}$/,qs=new gi(8192);function ek(e,n){const{strict:t=!0}={},u=`${e}.${t}`;if(qs.has(u))return qs.get(u);const i=Xb.test(e)?e.toLowerCase()===e?!0:t?nk(e)===e:!0:!1;return qs.set(u,i),i}var Ms=new gi(8192);function nk(e,n){if(Ms.has(`${e}.${n}`))return Ms.get(`${e}.${n}`);const t=e.substring(2).toLowerCase(),u=Yb($v(t)),i=t.split("");for(let a=0;a<40;a+=2)u[a>>1]>>4>=8&&i[a]&&(i[a]=i[a].toUpperCase()),(u[a>>1]&15)>=8&&i[a+1]&&(i[a+1]=i[a+1].toUpperCase());const r=`0x${i.join("")}`;return Ms.set(`${e}.${n}`,r),r}async function tk(e,{address:n,blockTag:t="latest",blockNumber:u}){const i=await e.request({method:"eth_getTransactionCount",params:[n,typeof u=="bigint"?Vs(u):t]},{dedupe:!!u});return Rb(i)}new gi(128),Vs(0,{size:32}),new gi(8192);var $t=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),bn=new Uint32Array(80),ik=class extends fi{constructor(){super(64,20,8,!1),this.A=$t[0]|0,this.B=$t[1]|0,this.C=$t[2]|0,this.D=$t[3]|0,this.E=$t[4]|0}get(){const{A:e,B:n,C:t,D:u,E:i}=this;return[e,n,t,u,i]}set(e,n,t,u,i){this.A=e|0,this.B=n|0,this.C=t|0,this.D=u|0,this.E=i|0}process(e,n){for(let o=0;o<16;o++,n+=4)bn[o]=e.getUint32(n,!1);for(let o=16;o<80;o++)bn[o]=dn(bn[o-3]^bn[o-8]^bn[o-14]^bn[o-16],1);let{A:t,B:u,C:i,D:r,E:a}=this;for(let o=0;o<80;o++){let s,c;o<20?(s=or(u,i,r),c=1518500249):o<40?(s=u^i^r,c=1859775393):o<60?(s=L4(u,i,r),c=2400959708):(s=u^i^r,c=3395469782);const l=dn(t,5)+s+a+c+bn[o]|0;a=r,r=i,i=dn(u,30),u=t,t=l}t=t+this.A|0,u=u+this.B|0,i=i+this.C|0,r=r+this.D|0,a=a+this.E|0,this.set(t,u,i,r,a)}roundClean(){Be(bn)}destroy(){this.set(0,0,0,0,0),Be(this.buffer)}};Je(()=>new ik);var uk=Math.pow(2,32),rk=Array.from({length:64},(e,n)=>Math.floor(uk*Math.abs(Math.sin(n+1)))),br=$t.slice(0,4),Gs=new Uint32Array(16),ak=class extends fi{constructor(){super(64,16,8,!0),this.A=br[0]|0,this.B=br[1]|0,this.C=br[2]|0,this.D=br[3]|0}get(){const{A:e,B:n,C:t,D:u}=this;return[e,n,t,u]}set(e,n,t,u){this.A=e|0,this.B=n|0,this.C=t|0,this.D=u|0}process(e,n){for(let a=0;a<16;a++,n+=4)Gs[a]=e.getUint32(n,!0);let{A:t,B:u,C:i,D:r}=this;for(let a=0;a<64;a++){let o,s,c;a<16?(o=or(u,i,r),s=a,c=[7,12,17,22]):a<32?(o=or(r,u,i),s=(5*a+1)%16,c=[5,9,14,20]):a<48?(o=u^i^r,s=(3*a+5)%16,c=[4,11,16,23]):(o=i^(u|~r),s=7*a%16,c=[6,10,15,21]),o=o+t+rk[a]+Gs[s],t=r,r=i,i=u,u=u+dn(o,c[a%4])}t=t+this.A|0,u=u+this.B|0,i=i+this.C|0,r=r+this.D|0,this.set(t,u,i,r)}roundClean(){Be(Gs)}destroy(){this.set(0,0,0,0),Be(this.buffer)}};Je(()=>new ak);var ok=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Rv=Uint8Array.from(new Array(16).fill(0).map((e,n)=>n)),sk=Rv.map(e=>(9*e+5)%16),jv=(()=>{const t=[[Rv],[sk]];for(let u=0;u<4;u++)for(let i of t)i.push(i[u].map(r=>ok[r]));return t})(),Lv=jv[0],Zv=jv[1],Vv=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),ck=Lv.map((e,n)=>e.map(t=>Vv[n][t])),lk=Zv.map((e,n)=>e.map(t=>Vv[n][t])),dk=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),fk=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function qv(e,n,t,u){return e===0?n^t^u:e===1?n&t|~n&u:e===2?(n|~t)^u:e===3?n&u|t&~u:n^(t|~u)}var kr=new Uint32Array(16),mk=class extends fi{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:n,h2:t,h3:u,h4:i}=this;return[e,n,t,u,i]}set(e,n,t,u,i){this.h0=e|0,this.h1=n|0,this.h2=t|0,this.h3=u|0,this.h4=i|0}process(e,n){for(let m=0;m<16;m++,n+=4)kr[m]=e.getUint32(n,!0);let t=this.h0|0,u=t,i=this.h1|0,r=i,a=this.h2|0,o=a,s=this.h3|0,c=s,l=this.h4|0,f=l;for(let m=0;m<5;m++){const d=4-m,v=dk[m],h=fk[m],b=Lv[m],y=Zv[m],E=ck[m],k=lk[m];for(let _=0;_<16;_++){const B=dn(t+qv(m,i,a,s)+kr[b[_]]+v,E[_])+l|0;t=l,l=s,s=dn(a,10)|0,a=i,i=B}for(let _=0;_<16;_++){const B=dn(u+qv(d,r,o,c)+kr[y[_]]+h,k[_])+f|0;u=f,f=c,c=dn(o,10)|0,o=r,r=B}}this.set(this.h1+a+c|0,this.h2+s+f|0,this.h3+l+u|0,this.h4+t+r|0,this.h0+i+o|0)}roundClean(){Be(kr)}destroy(){this.destroyed=!0,Be(this.buffer),this.set(0,0,0,0,0)}};Je(()=>new mk);function vk(e){const{source:n}=e,t=new Map,u=new gi(8192),i=new Map,r=({address:a,chainId:o})=>`${a}.${o}`;return{async consume({address:a,chainId:o,client:s}){const c=r({address:a,chainId:o}),l=this.get({address:a,chainId:o,client:s});this.increment({address:a,chainId:o});const f=await l;return await n.set({address:a,chainId:o},f),u.set(c,f),f},async increment({address:a,chainId:o}){const s=r({address:a,chainId:o}),c=t.get(s)??0;t.set(s,c+1)},async get({address:a,chainId:o,client:s}){const c=r({address:a,chainId:o});let l=i.get(c);return l||(l=(async()=>{try{const m=await n.get({address:a,chainId:o,client:s}),d=u.get(c)??0;return d>0&&m<=d?d+1:(u.delete(c),m)}finally{this.reset({address:a,chainId:o})}})(),i.set(c,l)),(t.get(c)??0)+await l},reset({address:a,chainId:o}){const s=r({address:a,chainId:o});t.delete(s),i.delete(s)}}}function pk(){return{async get(e){const{address:n,client:t}=e;return tk(t,{address:n,blockTag:"pending"})},set(){}}}vk({source:pk()});function hk(e,n={}){const{as:t=typeof e=="string"?"Hex":"Bytes"}=n,u=Uv(yb(e));return t==="Bytes"?u:Dv(u)}var gk=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const t=this.keys().next().value;t&&this.delete(t)}return this}},Ek={checksum:new gk(8192)},Js=Ek.checksum,yk=/^0x[a-fA-F0-9]{40}$/;function Mv(e,n={}){const{strict:t=!0}=n;if(!yk.test(e))throw new Gv({address:e,cause:new kk});if(t){if(e.toLowerCase()===e)return;if(bk(e)!==e)throw new Gv({address:e,cause:new Dk})}}function bk(e){if(Js.has(e))return Js.get(e);Mv(e,{strict:!1});const n=e.substring(2).toLowerCase(),t=hk(Db(n),{as:"Bytes"}),u=n.split("");for(let r=0;r<40;r+=2)t[r>>1]>>4>=8&&u[r]&&(u[r]=u[r].toUpperCase()),(t[r>>1]&15)>=8&&u[r+1]&&(u[r+1]=u[r+1].toUpperCase());const i=`0x${u.join("")}`;return Js.set(e,i),i}var Gv=class extends Te{constructor({address:e,cause:n}){super(`Address "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},kk=class extends Te{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},Dk=class extends Te{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}},Sk=/^(.*)\[([0-9]*)\]$/,Bk=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,wk=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Qs(e,n){if(e.length!==n.length)throw new _k({expectedLength:e.length,givenLength:n.length});const t=[];for(let u=0;u<e.length;u++){const i=e[u],r=n[u];t.push(Qs.encode(i,r))}return kv(...t)}(function(e){function n(t,u,i=!1){if(t==="address"){const s=u;return Mv(s),hr(s.toLowerCase(),i?32:0)}if(t==="string")return Fb(u);if(t==="bytes")return u;if(t==="bool")return hr(Cb(u),i?32:1);const r=t.match(wk);if(r){const[s,c,l="256"]=r,f=Number.parseInt(l)/8;return $b(u,{size:i?32:f,signed:c==="int"})}const a=t.match(Bk);if(a){const[s,c]=a;if(Number.parseInt(c)!==(u.length-2)/2)throw new Ak({expectedSize:Number.parseInt(c),value:u});return Rs(u,i?32:0)}const o=t.match(Sk);if(o&&Array.isArray(u)){const[s,c]=o,l=[];for(let f=0;f<u.length;f++)l.push(n(c,u[f],!0));return l.length===0?"0x":kv(...l)}throw new Ck(t)}e.encode=n})(Qs||(Qs={}));var Ak=class extends Te{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${js(n)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}},_k=class extends Te{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${e}`,`Given length (values): ${n}`].join(`
|
|
532
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},Ck=class extends Te{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}};function $k(e){if(!/^0[xX][0-9a-fA-F]{40}$/.test(e))return!1;const n="0x"+e.slice(2),t=n.slice(2);return t===t.toLowerCase()||t===t.toUpperCase()?!0:ek(n)}function Jv(e){try{return new sc.PublicKey(e),!0}catch{return!1}}const Hs=e=>Math.round((e+Number.EPSILON)*100)/100;function Fk(e){const n=e.replace(/^data:\w+\/\w+;base64,/,""),t=Buffer.from(n,"base64");return new Uint8Array(t)}class xk{client;constructor(n){this.client=n}async create(n){return(await this.client.query({query:kt,variables:{createDirectPaymentInput:{...n,amount:Hs(n.amount)}}}))?.createDirectPayment}async getWeb3PaymentParams(n){if(!$k(n.paymentTokenAddress))throw new Error("Invalid token address");return(await this.client.query({query:Ku,variables:{amount:Hs(n.paymentRequest.amountDue),network:n.paymentRequest.network,tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id}}))?.spritzPayParams}async getSolanaPaymentParams(n){if(!Jv(n.paymentTokenAddress))throw new Error(`Invalid token address: ${n.paymentTokenAddress}`);if(!Jv(n.signer))throw new Error(`Invalid signer: ${n.signer}`);const t=await this.client.query({query:Qu,variables:{amount:Hs(n.paymentRequest.amountDue),tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id,signer:n.signer}});return{versionedTransaction:sc.VersionedTransaction.deserialize(Fk(t?.solanaParams?.transactionSerialized??"")),transactionSerialized:t?.solanaParams?.transactionSerialized}}}var
|
|
533
|
-
getKycLinkToken(enhancedVerification: true)
|
|
534
|
-
}
|
|
535
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function Sr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Sr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Sr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Sr(u,n)})}var Ks={};(function(){Dr.definitions.forEach(function(n){if(n.name){var t=new Set;Sr(n,t),Ks[n.name.value]=t}})})();function Qv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Ik(e,n){var t={kind:e.kind,definitions:[Qv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ks[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ks[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Qv(e,o);s&&t.definitions.push(s)}),t}Ik(Dr,"GetKycLinkToken");var Ft={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VerificationFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Verification"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"identity"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canRetry"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationMetadata"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"failureReason"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"details"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"matchedEmail"},arguments:[],directives:[]}]}}]}}]}}]}}],loc:{start:0,end:286}};Ft.loc.source={body:`fragment VerificationFragment on Verification {
|
|
533
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},Ck=class extends Te{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}};function $k(e){if(!/^0[xX][0-9a-fA-F]{40}$/.test(e))return!1;const n="0x"+e.slice(2),t=n.slice(2);return t===t.toLowerCase()||t===t.toUpperCase()?!0:ek(n)}function Jv(e){try{return new sc.PublicKey(e),!0}catch{return!1}}const Hs=e=>Math.round((e+Number.EPSILON)*100)/100;function Fk(e){const n=e.replace(/^data:\w+\/\w+;base64,/,""),t=Buffer.from(n,"base64");return new Uint8Array(t)}class xk{client;constructor(n){this.client=n}async create(n){return(await this.client.query({query:kt,variables:{createDirectPaymentInput:{...n,amount:Hs(n.amount)}}}))?.createDirectPayment}async getWeb3PaymentParams(n){if(!$k(n.paymentTokenAddress))throw new Error("Invalid token address");return(await this.client.query({query:Ku,variables:{amount:Hs(n.paymentRequest.amountDue),network:n.paymentRequest.network,tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id}}))?.spritzPayParams}async getSolanaPaymentParams(n){if(!Jv(n.paymentTokenAddress))throw new Error(`Invalid token address: ${n.paymentTokenAddress}`);if(!Jv(n.signer))throw new Error(`Invalid signer: ${n.signer}`);const t=await this.client.query({query:Qu,variables:{amount:Hs(n.paymentRequest.amountDue),tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id,signer:n.signer}});return{versionedTransaction:sc.VersionedTransaction.deserialize(Fk(t?.solanaParams?.transactionSerialized??"")),transactionSerialized:t?.solanaParams?.transactionSerialized}}}var Ft={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VerificationFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Verification"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"identity"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canRetry"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationMetadata"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"failureReason"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"details"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"matchedEmail"},arguments:[],directives:[]}]}}]}}]}}]}}],loc:{start:0,end:286}};Ft.loc.source={body:`fragment VerificationFragment on Verification {
|
|
536
534
|
userId
|
|
537
535
|
identity {
|
|
538
536
|
canRetry
|
|
@@ -547,14 +545,22 @@ mutation CreatePaymentRequest($createDirectPaymentInput: CreateDirectPaymentInpu
|
|
|
547
545
|
}
|
|
548
546
|
}
|
|
549
547
|
}
|
|
550
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function
|
|
548
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function Dr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Dr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Dr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Dr(u,n)})}var Ks={};(function(){Ft.definitions.forEach(function(n){if(n.name){var t=new Set;Dr(n,t),Ks[n.name.value]=t}})})();function Qv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Ik(e,n){var t={kind:e.kind,definitions:[Qv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ks[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ks[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Qv(e,o);s&&t.definitions.push(s)}),t}Ik(Ft,"VerificationFragment");var xt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"RetryFailedVerification"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"retryFailedVerification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VerificationFragment"},directives:[]}]}}]}}],loc:{start:0,end:156}};xt.loc.source={body:`#import "../queries/verificationFragment.graphql"
|
|
551
549
|
|
|
552
550
|
mutation RetryFailedVerification {
|
|
553
551
|
retryFailedVerification {
|
|
554
552
|
...VerificationFragment
|
|
555
553
|
}
|
|
556
554
|
}
|
|
557
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var
|
|
555
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Hv={};function Nk(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Hv[t]?!1:(Hv[t]=!0,!0)})}xt.definitions=xt.definitions.concat(Nk(Ft.definitions));function Sr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Sr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Sr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Sr(u,n)})}var Ws={};(function(){xt.definitions.forEach(function(n){if(n.name){var t=new Set;Sr(n,t),Ws[n.name.value]=t}})})();function Kv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Tk(e,n){var t={kind:e.kind,definitions:[Kv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ws[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ws[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Kv(e,o);s&&t.definitions.push(s)}),t}Tk(xt,"RetryFailedVerification");var Br={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"GetVerificationParams"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getVerificationParams"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"inquiryId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sessionToken"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrlExpiresAt"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:165}};Br.loc.source={body:`mutation GetVerificationParams {
|
|
556
|
+
getVerificationParams {
|
|
557
|
+
inquiryId
|
|
558
|
+
verificationUrl
|
|
559
|
+
sessionToken
|
|
560
|
+
verificationUrlExpiresAt
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function wr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){wr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){wr(u,n)}),e.definitions&&e.definitions.forEach(function(u){wr(u,n)})}var Ys={};(function(){Br.definitions.forEach(function(n){if(n.name){var t=new Set;wr(n,t),Ys[n.name.value]=t}})})();function Wv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Ok(e,n){var t={kind:e.kind,definitions:[Wv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ys[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ys[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Wv(e,o);s&&t.definitions.push(s)}),t}Ok(Br,"GetVerificationParams");var Ei={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"User"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"firstName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"timezone"},arguments:[],directives:[]}]}}],loc:{start:0,end:105}};Ei.loc.source={body:`fragment UserFragment on User {
|
|
558
564
|
id
|
|
559
565
|
email
|
|
560
566
|
firstName
|
|
@@ -594,7 +600,7 @@ query UserAccess {
|
|
|
594
600
|
hasAcceptedTos
|
|
595
601
|
}
|
|
596
602
|
}
|
|
597
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var tp={};function ip(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return tp[t]?!1:(tp[t]=!0,!0)})}Dn.definitions=Dn.definitions.concat(ip(Ei.definitions)),Dn.definitions=Dn.definitions.concat(ip(Ft.definitions));function Cr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Cr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Cr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Cr(u,n)})}var nc={};(function(){Dn.definitions.forEach(function(n){if(n.name){var t=new Set;Cr(n,t),nc[n.name.value]=t}})})();function up(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Pk(e,n){var t={kind:e.kind,definitions:[up(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=nc[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=nc[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=up(e,o);s&&t.definitions.push(s)}),t}Pk(Dn,"UserAccess");var rn=(e=>(e.NotStarted="not_started",e.Pending="pending",e.Completed="completed",e.Failed="failed",e))(rn||{}),Oe=(e=>(e.IdentityVerification="identity_verification",e.TermsAcceptance="terms_acceptance",e.AdditionalVerification="additional_verification",e.RegionalCompliance="regional_compliance",e.RiskEvaluation="risk_evaluation",e.DocumentSubmission="document_submission",e))(Oe||{}),$r=(e=>(e.AchPurchase="ach_purchase",e.WirePurchase="wire_purchase",e))($r||{}),rp=(e=>(e.UsBankAccount="us_bank_account",e.UsBills="us_bills",e.UsDebitCard="us_debit_card",e.IbanTransfer="iban_transfer",e.UkBankAccount="uk_bank_account",e.CaBankAccount="ca_bank_account",e))(rp||{}),ap=(e=>(e.UsVirtualCard="us_virtual_card",e.UsPhysicalCard="us_physical_card",e))(ap||{}),Rk=(e=>(e.VerifySms="verify_sms",e.DocumentVerification="documentary_verification",e.RiskCheck="risk_check",e.KycCheck="kyc_check",e.WatchlistScreening="watchlist_screening",e.SelfieCheck="selfie_check",e.AddressInvalid="address_invalid",e.DuplicateIdentity="duplicate_identity",e))(Rk||{}),It=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(It||{});function jk(e=rt.INITIALIZED){switch(e){case rt.FAILED:return"failed";case rt.ACTIVE:return"verified";case rt.DISABLED:return"disabled";case rt.RETRY:return"failed";default:return"not_started"}}function op(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:jk(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}function Lk(e,n){return{verified:e===It.Verified,country:n??null}}function Zk({verificationUrl:e,verificationStatus:n,retryable:t}){if(n!==It.Verified)return n===It.Failed?{type:Oe.IdentityVerification,description:"Identity verification failed. Please retry verification.",retryable:t,status:rn.Failed}:n===It.NotStarted?{type:Oe.IdentityVerification,description:"Verify your identity to unlock features",actionUrl:e,status:rn.NotStarted}:{type:Oe.IdentityVerification,description:"Identity verification pending review",status:rn.Pending}}function Vk(e){try{const n=new URL(e);return n.searchParams.delete("redirect_uri"),n.toString()}catch{return e}}function qk(e,n){if(!e&&n)return{type:Oe.TermsAcceptance,description:"Please review and accept the terms of service",actionUrl:Vk(n),status:rn.NotStarted}}function Mk(e){if(!e)return{type:Oe.IdentityVerification,status:rn.NotStarted};if(!(e.status==="active"||e.status==="approved"))return e.status==="rejected"||e.status==="failed"?{type:Oe.IdentityVerification,status:rn.Failed}:e.status==="pending"||e.status==="in_review"?{type:Oe.IdentityVerification,status:rn.Pending}:{type:Oe.IdentityVerification,status:rn.NotStarted}}function Gk(e){if(!e)return[];if(!["US"].includes(e.toUpperCase()))return[];const n=[];return e.toUpperCase()==="US"&&n.push($r.AchPurchase,$r.WirePurchase),n}function Jk(e,n){const t=Gk(e.country??null);if(!e.verified)return{active:!1,features:[],requirements:[]};const u=[],i=qk(n?.hasAcceptedTos??!1,n?.tosLink);i&&u.push(i);const r=Mk(n);if(r&&u.push(r),t.length===0)return{active:!1,features:[],requirements:u};const a={active:u.length===0,features:u.length===0?t:[],requirements:u};return i?a.nextRequirement=Oe.TermsAcceptance:r&&(a.nextRequirement=Oe.IdentityVerification),a}function Qk(e,n,t){const u=e?.bridgeUser,i=e?.verification?.identity?.canRetry??!1,r=e?.verification?.identity?.verificationUrl??null,a=Lk(n,t),o=Zk({verificationStatus:n,retryable:i,verificationUrl:r}),s={onramp:Jk(a,u)};return{kycStatus:a,...o&&{kycRequirement:o},capabilities:s}}class Hk{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:kn});return op(n)}async retryFailedVerification(){return await this.client.query({query:xt}),this.getCurrentUser()}async
|
|
603
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var tp={};function ip(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return tp[t]?!1:(tp[t]=!0,!0)})}Dn.definitions=Dn.definitions.concat(ip(Ei.definitions)),Dn.definitions=Dn.definitions.concat(ip(Ft.definitions));function Cr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Cr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Cr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Cr(u,n)})}var nc={};(function(){Dn.definitions.forEach(function(n){if(n.name){var t=new Set;Cr(n,t),nc[n.name.value]=t}})})();function up(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Pk(e,n){var t={kind:e.kind,definitions:[up(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=nc[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=nc[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=up(e,o);s&&t.definitions.push(s)}),t}Pk(Dn,"UserAccess");var rn=(e=>(e.NotStarted="not_started",e.Pending="pending",e.Completed="completed",e.Failed="failed",e))(rn||{}),Oe=(e=>(e.IdentityVerification="identity_verification",e.TermsAcceptance="terms_acceptance",e.AdditionalVerification="additional_verification",e.RegionalCompliance="regional_compliance",e.RiskEvaluation="risk_evaluation",e.DocumentSubmission="document_submission",e))(Oe||{}),$r=(e=>(e.AchPurchase="ach_purchase",e.WirePurchase="wire_purchase",e))($r||{}),rp=(e=>(e.UsBankAccount="us_bank_account",e.UsBills="us_bills",e.UsDebitCard="us_debit_card",e.IbanTransfer="iban_transfer",e.UkBankAccount="uk_bank_account",e.CaBankAccount="ca_bank_account",e))(rp||{}),ap=(e=>(e.UsVirtualCard="us_virtual_card",e.UsPhysicalCard="us_physical_card",e))(ap||{}),Rk=(e=>(e.VerifySms="verify_sms",e.DocumentVerification="documentary_verification",e.RiskCheck="risk_check",e.KycCheck="kyc_check",e.WatchlistScreening="watchlist_screening",e.SelfieCheck="selfie_check",e.AddressInvalid="address_invalid",e.DuplicateIdentity="duplicate_identity",e))(Rk||{}),It=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(It||{});function jk(e=rt.INITIALIZED){switch(e){case rt.FAILED:return"failed";case rt.ACTIVE:return"verified";case rt.DISABLED:return"disabled";case rt.RETRY:return"failed";default:return"not_started"}}function op(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:jk(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}function Lk(e,n){return{verified:e===It.Verified,country:n??null}}function Zk({verificationUrl:e,verificationStatus:n,retryable:t}){if(n!==It.Verified)return n===It.Failed?{type:Oe.IdentityVerification,description:"Identity verification failed. Please retry verification.",retryable:t,status:rn.Failed}:n===It.NotStarted?{type:Oe.IdentityVerification,description:"Verify your identity to unlock features",actionUrl:e,status:rn.NotStarted}:{type:Oe.IdentityVerification,description:"Identity verification pending review",status:rn.Pending}}function Vk(e){try{const n=new URL(e);return n.searchParams.delete("redirect_uri"),n.toString()}catch{return e}}function qk(e,n){if(!e&&n)return{type:Oe.TermsAcceptance,description:"Please review and accept the terms of service",actionUrl:Vk(n),status:rn.NotStarted}}function Mk(e){if(!e)return{type:Oe.IdentityVerification,status:rn.NotStarted};if(!(e.status==="active"||e.status==="approved"))return e.status==="rejected"||e.status==="failed"?{type:Oe.IdentityVerification,status:rn.Failed}:e.status==="pending"||e.status==="in_review"?{type:Oe.IdentityVerification,status:rn.Pending}:{type:Oe.IdentityVerification,status:rn.NotStarted}}function Gk(e){if(!e)return[];if(!["US"].includes(e.toUpperCase()))return[];const n=[];return e.toUpperCase()==="US"&&n.push($r.AchPurchase,$r.WirePurchase),n}function Jk(e,n){const t=Gk(e.country??null);if(!e.verified)return{active:!1,features:[],requirements:[]};const u=[],i=qk(n?.hasAcceptedTos??!1,n?.tosLink);i&&u.push(i);const r=Mk(n);if(r&&u.push(r),t.length===0)return{active:!1,features:[],requirements:u};const a={active:u.length===0,features:u.length===0?t:[],requirements:u};return i?a.nextRequirement=Oe.TermsAcceptance:r&&(a.nextRequirement=Oe.IdentityVerification),a}function Qk(e,n,t){const u=e?.bridgeUser,i=e?.verification?.identity?.canRetry??!1,r=e?.verification?.identity?.verificationUrl??null,a=Lk(n,t),o=Zk({verificationStatus:n,retryable:i,verificationUrl:r}),s={onramp:Jk(a,u)};return{kycStatus:a,...o&&{kycRequirement:o},capabilities:s}}class Hk{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:kn});return op(n)}async retryFailedVerification(){return await this.client.query({query:xt}),this.getCurrentUser()}async getVerificationParams(){return(await this.client.query({query:Br})).getVerificationParams}async getUserAccess(){const n=await this.client.query({query:Dn}),t=op(n),u=t?.verificationStatus??It.NotStarted,i=t?.verifiedCountry??null;return Qk(n,u,i)}}var yi={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:469}};yi.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
|
|
598
604
|
id
|
|
599
605
|
name
|
|
600
606
|
userId
|
|
@@ -213,6 +213,7 @@ interface AccountPayments_paymentsForAccount {
|
|
|
213
213
|
targetCurrency: string | null;
|
|
214
214
|
targetCurrencyAmount: number;
|
|
215
215
|
targetCurrencyRate: number | null;
|
|
216
|
+
failureReason: string | null;
|
|
216
217
|
transaction: AccountPayments_paymentsForAccount_transaction | null;
|
|
217
218
|
}
|
|
218
219
|
interface AccountPayments {
|
|
@@ -646,6 +647,7 @@ interface Payment_payment {
|
|
|
646
647
|
targetCurrency: string | null;
|
|
647
648
|
targetCurrencyAmount: number;
|
|
648
649
|
targetCurrencyRate: number | null;
|
|
650
|
+
failureReason: string | null;
|
|
649
651
|
transaction: Payment_payment_transaction | null;
|
|
650
652
|
}
|
|
651
653
|
interface Payment {
|
|
@@ -677,6 +679,7 @@ interface PaymentFragment {
|
|
|
677
679
|
targetCurrency: string | null;
|
|
678
680
|
targetCurrencyAmount: number;
|
|
679
681
|
targetCurrencyRate: number | null;
|
|
682
|
+
failureReason: string | null;
|
|
680
683
|
transaction: PaymentFragment_transaction | null;
|
|
681
684
|
}
|
|
682
685
|
|
|
@@ -719,6 +722,7 @@ interface PaymentRequestPayment_paymentForPaymentRequest {
|
|
|
719
722
|
targetCurrency: string | null;
|
|
720
723
|
targetCurrencyAmount: number;
|
|
721
724
|
targetCurrencyRate: number | null;
|
|
725
|
+
failureReason: string | null;
|
|
722
726
|
transaction: PaymentRequestPayment_paymentForPaymentRequest_transaction | null;
|
|
723
727
|
}
|
|
724
728
|
interface PaymentRequestPayment {
|
|
@@ -830,7 +834,7 @@ interface UserAccess_bridgeUser {
|
|
|
830
834
|
interface UserAccess {
|
|
831
835
|
me: UserAccess_me;
|
|
832
836
|
verification: UserAccess_verification | null;
|
|
833
|
-
bridgeUser: UserAccess_bridgeUser;
|
|
837
|
+
bridgeUser: UserAccess_bridgeUser | null;
|
|
834
838
|
}
|
|
835
839
|
|
|
836
840
|
interface UserBankAccounts_bankAccounts_bankAccountDetails_CanadianBankAccountDetails {
|
|
@@ -1819,6 +1823,14 @@ declare class PaymentRequestService {
|
|
|
1819
1823
|
}>;
|
|
1820
1824
|
}
|
|
1821
1825
|
|
|
1826
|
+
interface GetVerificationParams_getVerificationParams {
|
|
1827
|
+
__typename: 'VerificationParams';
|
|
1828
|
+
inquiryId: string;
|
|
1829
|
+
verificationUrl: string | null;
|
|
1830
|
+
sessionToken: string | null;
|
|
1831
|
+
verificationUrlExpiresAt: any | null;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1822
1834
|
declare enum VerificationFailureReason {
|
|
1823
1835
|
VerifySms = "verify_sms",
|
|
1824
1836
|
DocumentVerification = "documentary_verification",
|
|
@@ -1943,7 +1955,7 @@ declare class UserService {
|
|
|
1943
1955
|
};
|
|
1944
1956
|
} | null;
|
|
1945
1957
|
}) | null>;
|
|
1946
|
-
|
|
1958
|
+
getVerificationParams(): Promise<GetVerificationParams_getVerificationParams>;
|
|
1947
1959
|
getUserAccess(): Promise<UserAccessCapabilities>;
|
|
1948
1960
|
}
|
|
1949
1961
|
|
|
@@ -411,7 +411,7 @@ query VirtualAccounts {
|
|
|
411
411
|
virtualAccounts {
|
|
412
412
|
...VirtualAccountFragment
|
|
413
413
|
}
|
|
414
|
-
}`,name:"GraphQL request",locationOffset:{line:1,column:1}};var d4={};function LE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return d4[t]?!1:(d4[t]=!0,!0)})}ht.definitions=ht.definitions.concat(LE(oi.definitions));function ju(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){ju(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){ju(u,n)}),e.definitions&&e.definitions.forEach(function(u){ju(u,n)})}var fs={};(function(){ht.definitions.forEach(function(n){if(n.name){var t=new Set;ju(n,t),fs[n.name.value]=t}})})();function f4(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function ZE(e,n){var t={kind:e.kind,definitions:[f4(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=f4(e,o);s&&t.definitions.push(s)}),t}ZE(ht,"VirtualAccounts");var Me=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(Me||{});const m4={[Me.Ethereum]:["USDC","USDT","DAI","USDP","PYUSD"],[Me.Polygon]:["USDC"],[Me.Base]:["USDC"],[Me.Arbitrum]:["USDC"],[Me.Avalanche]:["USDC"],[Me.Optimism]:["USDC"],[Me.Solana]:["USDC","PYUSD"],[Me.Tron]:["USDT"]};function VE(e){const{network:n,token:t}=e,u=m4[n];if(!u||!u.includes(t))throw new Error(`Token "${t}" is not supported on network "${n}". Supported tokens for ${n}: ${u?.join(", ")||"none"}`)}class qE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:ht})).virtualAccounts}async create(n){return VE(n),(await this.client.query({query:pt,variables:{network:n.network,address:n.address,token:n.token}})).createVirtualAccount}}var gt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"paymentRequestId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyRate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"transaction"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hash"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"from"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"asset"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:
|
|
414
|
+
}`,name:"GraphQL request",locationOffset:{line:1,column:1}};var d4={};function LE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return d4[t]?!1:(d4[t]=!0,!0)})}ht.definitions=ht.definitions.concat(LE(oi.definitions));function ju(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){ju(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){ju(u,n)}),e.definitions&&e.definitions.forEach(function(u){ju(u,n)})}var fs={};(function(){ht.definitions.forEach(function(n){if(n.name){var t=new Set;ju(n,t),fs[n.name.value]=t}})})();function f4(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function ZE(e,n){var t={kind:e.kind,definitions:[f4(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=f4(e,o);s&&t.definitions.push(s)}),t}ZE(ht,"VirtualAccounts");var Me=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(Me||{});const m4={[Me.Ethereum]:["USDC","USDT","DAI","USDP","PYUSD"],[Me.Polygon]:["USDC"],[Me.Base]:["USDC"],[Me.Arbitrum]:["USDC"],[Me.Avalanche]:["USDC"],[Me.Optimism]:["USDC"],[Me.Solana]:["USDC","PYUSD"],[Me.Tron]:["USDT"]};function VE(e){const{network:n,token:t}=e,u=m4[n];if(!u||!u.includes(t))throw new Error(`Token "${t}" is not supported on network "${n}". Supported tokens for ${n}: ${u?.join(", ")||"none"}`)}class qE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:ht})).virtualAccounts}async create(n){return VE(n),(await this.client.query({query:pt,variables:{network:n.network,address:n.address,token:n.token}})).createVirtualAccount}}var gt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"paymentRequestId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"targetCurrencyRate"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"failureReason"},name:{kind:"Name",value:"error"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"transaction"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hash"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"from"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"asset"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:348}};gt.loc.source={body:`fragment PaymentFragment on Payment {
|
|
415
415
|
id
|
|
416
416
|
userId
|
|
417
417
|
status
|
|
@@ -424,6 +424,7 @@ query VirtualAccounts {
|
|
|
424
424
|
targetCurrency
|
|
425
425
|
targetCurrencyAmount
|
|
426
426
|
targetCurrencyRate
|
|
427
|
+
failureReason: error
|
|
427
428
|
transaction {
|
|
428
429
|
hash
|
|
429
430
|
from
|
|
@@ -529,10 +530,7 @@ mutation CreatePaymentRequest($createDirectPaymentInput: CreateDirectPaymentInpu
|
|
|
529
530
|
*/var pb="0.1.1";function hb(){return pb}var Te=class rc extends Error{constructor(n,t={}){const u=(()=>{if(t.cause instanceof rc){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&typeof t.cause.details=="string"?t.cause.details:t.cause?.message?t.cause.message:t.details})(),i=t.cause instanceof rc&&t.cause.docsPath||t.docsPath,a=`https://oxlib.sh${i??""}`,o=[n||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...u||i?["",u?`Details: ${u}`:void 0,i?`See: ${a}`:void 0]:[]].filter(s=>typeof s=="string").join(`
|
|
530
531
|
`);super(o,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${hb()}`}),this.cause=t.cause,this.details=u,this.docs=a,this.docsPath=i,this.shortMessage=n}walk(n){return hv(this,n)}};function hv(e,n){return n?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?hv(e.cause,n):n?null:e}function gb(e,n){if(yv(e)>n)throw new wb({givenSize:yv(e),maxSize:n})}var tn={zero:48,nine:57,A:65,F:70,a:97,f:102};function gv(e){if(e>=tn.zero&&e<=tn.nine)return e-tn.zero;if(e>=tn.A&&e<=tn.F)return e-(tn.A-10);if(e>=tn.a&&e<=tn.f)return e-(tn.a-10)}function Eb(e,n={}){const{dir:t,size:u=32}=n;if(u===0)return e;if(e.length>u)throw new Ab({size:e.length,targetSize:u,type:"Bytes"});const i=new Uint8Array(u);for(let r=0;r<u;r++){const a=t==="right";i[a?r:u-r-1]=e[a?r:e.length-r-1]}return i}function Ps(e,n){if(js(e)>n)throw new Nb({givenSize:js(e),maxSize:n})}function Ev(e,n={}){const{dir:t,size:u=32}=n;if(u===0)return e;const i=e.replace("0x","");if(i.length>u*2)throw new Tb({size:Math.ceil(i.length/2),targetSize:u,type:"Hex"});return`0x${i[t==="right"?"padEnd":"padStart"](u*2,"0")}`}new TextDecoder;var yb=new TextEncoder;function bb(e){return e instanceof Uint8Array?e:typeof e=="string"?Db(e):kb(e)}function kb(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Db(e,n={}){const{size:t}=n;let u=e;t&&(Ps(e,t),u=Rs(e,t));let i=u.slice(2);i.length%2&&(i=`0${i}`);const r=i.length/2,a=new Uint8Array(r);for(let o=0,s=0;o<r;o++){const c=gv(i.charCodeAt(s++)),l=gv(i.charCodeAt(s++));if(c===void 0||l===void 0)throw new Te(`Invalid byte sequence ("${i[s-2]}${i[s-1]}" in "${i}").`);a[o]=c*16+l}return a}function Sb(e,n={}){const{size:t}=n,u=yb.encode(e);return typeof t=="number"?(gb(u,t),Bb(u,t)):u}function Bb(e,n){return Eb(e,{dir:"right",size:n})}function yv(e){return e.length}var wb=class extends Te{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Ab=class extends Te{constructor({size:e,targetSize:n,type:t}){super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}},_b=new TextEncoder,Cb=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function bv(...e){return`0x${e.reduce((n,t)=>n+t.replace("0x",""),"")}`}function $b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(Ps(t,n.size),hr(t,n.size)):t}function kv(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=Cb[e[i]];const u=`0x${t}`;return typeof n.size=="number"?(Ps(u,n.size),Rs(u,n.size)):u}function xb(e,n={}){const{signed:t,size:u}=n,i=BigInt(e);let r;u?t?r=(1n<<BigInt(u)*8n-1n)-1n:r=2n**(BigInt(u)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&t?-r-1n:0;if(r&&i>r||i<a){const c=typeof e=="bigint"?"n":"";throw new Ib({max:r?`${r}${c}`:void 0,min:`${a}${c}`,signed:t,size:u,value:`${e}${c}`})}const s=`0x${(t&&i<0?(1n<<BigInt(u*8))+BigInt(i):i).toString(16)}`;return u?hr(s,u):s}function Fb(e,n={}){return kv(_b.encode(e),n)}function hr(e,n){return Ev(e,{dir:"left",size:n})}function Rs(e,n){return Ev(e,{dir:"right",size:n})}function js(e){return Math.ceil((e.length-2)/2)}var Ib=class extends Te{constructor({max:e,min:n,signed:t,size:u,value:i}){super(`Number \`${i}\` is not in safe${u?` ${u*8}-bit`:""}${t?" signed":" unsigned"} integer range ${e?`(\`${n}\` to \`${e}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Nb=class extends Te{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},Tb=class extends Te{constructor({size:e,targetSize:n,type:t}){super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}},Dv="2.31.7",Ls={getDocsUrl:({docsBaseUrl:e,docsPath:n="",docsSlug:t})=>n?`${e??"https://viem.sh"}${n}${t?`#${t}`:""}`:void 0,version:`viem@${Dv}`},gr=class ac extends Error{constructor(n,t={}){const u=t.cause instanceof ac?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof ac&&t.cause.docsPath||t.docsPath,r=Ls.getDocsUrl?.({...t,docsPath:i}),a=[n||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...u?[`Details: ${u}`]:[],...Ls.version?[`Version: ${Ls.version}`]:[]].join(`
|
|
531
532
|
`);super(a,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=u,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=n,this.version=Dv}walk(n){return Sv(this,n)}};function Sv(e,n){return n?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Sv(e.cause,n):n?null:e}function Zs(e,{strict:n=!0}={}){return!e||typeof e!="string"?!1:n?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Bv(e){return Zs(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var wv=class extends gr{constructor({size:e,targetSize:n,type:t}){super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function Er(e,{dir:n,size:t=32}={}){return typeof e=="string"?Ob(e,{dir:n,size:t}):zb(e,{dir:n,size:t})}function Ob(e,{dir:n,size:t=32}={}){if(t===null)return e;const u=e.replace("0x","");if(u.length>t*2)throw new wv({size:Math.ceil(u.length/2),targetSize:t,type:"hex"});return`0x${u[n==="right"?"padEnd":"padStart"](t*2,"0")}`}function zb(e,{dir:n,size:t=32}={}){if(t===null)return e;if(e.length>t)throw new wv({size:e.length,targetSize:t,type:"bytes"});const u=new Uint8Array(t);for(let i=0;i<t;i++){const r=n==="right";u[r?i:t-i-1]=e[r?i:e.length-i-1]}return u}var Ub=class extends gr{constructor({max:e,min:n,signed:t,size:u,value:i}){super(`Number "${i}" is not in safe ${u?`${u*8}-bit ${t?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},Pb=class extends gr{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function yr(e,{size:n}){if(Bv(e)>n)throw new Pb({givenSize:Bv(e),maxSize:n})}function Rb(e,n={}){const{signed:t}=n;n.size&&yr(e,{size:n.size});const u=BigInt(e);if(!t)return u;const i=(e.length-2)/2,r=(1n<<BigInt(i)*8n-1n)-1n;return u<=r?u:u-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function jb(e,n={}){return Number(Rb(e,n))}Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function Vs(e,n={}){const{signed:t,size:u}=n,i=BigInt(e);let r;u?t?r=(1n<<BigInt(u)*8n-1n)-1n:r=2n**(BigInt(u)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&t?-r-1n:0;if(r&&i>r||i<a){const s=typeof e=="bigint"?"n":"";throw new Ub({max:r?`${r}${s}`:void 0,min:`${a}${s}`,signed:t,size:u,value:`${e}${s}`})}const o=`0x${(t&&i<0?(1n<<BigInt(u*8))+BigInt(i):i).toString(16)}`;return u?Er(o,{size:u}):o}new TextEncoder;var Lb=new TextEncoder;function Zb(e,n={}){return typeof e=="number"||typeof e=="bigint"?qb(e,n):typeof e=="boolean"?Vb(e,n):Zs(e)?_v(e,n):Cv(e,n)}function Vb(e,n={}){const t=new Uint8Array(1);return t[0]=Number(e),typeof n.size=="number"?(yr(t,{size:n.size}),Er(t,{size:n.size})):t}var un={zero:48,nine:57,A:65,F:70,a:97,f:102};function Av(e){if(e>=un.zero&&e<=un.nine)return e-un.zero;if(e>=un.A&&e<=un.F)return e-(un.A-10);if(e>=un.a&&e<=un.f)return e-(un.a-10)}function _v(e,n={}){let t=e;n.size&&(yr(t,{size:n.size}),t=Er(t,{dir:"right",size:n.size}));let u=t.slice(2);u.length%2&&(u=`0${u}`);const i=u.length/2,r=new Uint8Array(i);for(let a=0,o=0;a<i;a++){const s=Av(u.charCodeAt(o++)),c=Av(u.charCodeAt(o++));if(s===void 0||c===void 0)throw new gr(`Invalid byte sequence ("${u[o-2]}${u[o-1]}" in "${u}").`);r[a]=s*16+c}return r}function qb(e,n){const t=Vs(e,n);return _v(t)}function Cv(e,n={}){const t=Lb.encode(e);return typeof n.size=="number"?(yr(t,{size:n.size}),Er(t,{dir:"right",size:n.size})):t}var Mb=BigInt(0),hi=BigInt(1),Gb=BigInt(2),Jb=BigInt(7),Qb=BigInt(256),Hb=BigInt(113),$v=[],xv=[],Fv=[];for(let e=0,n=hi,t=1,u=0;e<24;e++){[t,u]=[u,(2*t+3*u)%5],$v.push(2*(5*u+t)),xv.push((e+1)*(e+2)/2%64);let i=Mb;for(let r=0;r<7;r++)n=(n<<hi^(n>>Jb)*Hb)%Qb,n&Gb&&(i^=hi<<(hi<<BigInt(r))-hi);Fv.push(i)}var Iv=U4(Fv,!0),Kb=Iv[0],Wb=Iv[1],Nv=(e,n,t)=>t>32?gy(e,n,t):py(e,n,t),Tv=(e,n,t)=>t>32?Ey(e,n,t):hy(e,n,t);function Yb(e,n=24){const t=new Uint32Array(10);for(let u=24-n;u<24;u++){for(let a=0;a<10;a++)t[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,s=(a+2)%10,c=t[s],l=t[s+1],f=Nv(c,l,1)^t[o],m=Tv(c,l,1)^t[o+1];for(let d=0;d<50;d+=10)e[a+d]^=f,e[a+d+1]^=m}let i=e[2],r=e[3];for(let a=0;a<24;a++){const o=xv[a],s=Nv(i,r,o),c=Tv(i,r,o),l=$v[a];i=e[l],r=e[l+1],e[l]=s,e[l+1]=c}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)t[o]=e[a+o];for(let o=0;o<10;o++)e[a+o]^=~t[(o+2)%10]&t[(o+4)%10]}e[0]^=Kb[u],e[1]^=Wb[u]}Be(t)}var Ov=class fp extends Ss{constructor(n,t,u,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=n,this.suffix=t,this.outputLen=u,this.enableXOF=i,this.rounds=r,si(u),!(0<n&&n<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ry(this.state)}clone(){return this._cloneInto()}keccak(){_4(this.state32),Yb(this.state32,this.rounds),_4(this.state32),this.posOut=0,this.pos=0}update(n){St(this),n=li(n),fe(n);const{blockLen:t,state:u}=this,i=n.length;for(let r=0;r<i;){const a=Math.min(t-this.pos,i-r);for(let o=0;o<a;o++)u[this.pos++]^=n[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:n,suffix:t,pos:u,blockLen:i}=this;n[u]^=t,(t&128)!==0&&u===i-1&&this.keccak(),n[i-1]^=128,this.keccak()}writeInto(n){St(this,!1),fe(n),this.finish();const t=this.state,{blockLen:u}=this;for(let i=0,r=n.length;i<r;){this.posOut>=u&&this.keccak();const a=Math.min(u-this.posOut,r-i);n.set(t.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return n}xofInto(n){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(n)}xof(n){return si(n),this.xofInto(new Uint8Array(n))}digestInto(n){if(A4(n,this),this.finished)throw new Error("digest() was already called");return this.writeInto(n),this.destroy(),n}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Be(this.state)}_cloneInto(n){const{blockLen:t,suffix:u,outputLen:i,rounds:r,enableXOF:a}=this;return n||(n=new fp(t,u,i,a,r)),n.state32.set(this.state32),n.pos=this.pos,n.posOut=this.posOut,n.finished=this.finished,n.rounds=r,n.suffix=u,n.outputLen=i,n.enableXOF=a,n.destroyed=this.destroyed,n}},yn=(e,n,t)=>Je(()=>new Ov(n,e,t));yn(6,144,224/8),yn(6,136,256/8),yn(6,104,384/8),yn(6,72,512/8),yn(1,144,224/8);var zv=yn(1,136,256/8);yn(1,104,384/8),yn(1,72,512/8);var Uv=(e,n,t)=>ly((u={})=>new Ov(n,e,u.dkLen===void 0?t:u.dkLen,!0));Uv(31,168,128/8),Uv(31,136,256/8);function Xb(e,n){return zv(Zs(e,{strict:!1})?Zb(e):e)}var gi=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const t=this.keys().next().value;t&&this.delete(t)}return this}},ek=/^0x[a-fA-F0-9]{40}$/,qs=new gi(8192);function nk(e,n){const{strict:t=!0}={},u=`${e}.${t}`;if(qs.has(u))return qs.get(u);const i=ek.test(e)?e.toLowerCase()===e?!0:t?tk(e)===e:!0:!1;return qs.set(u,i),i}var Ms=new gi(8192);function tk(e,n){if(Ms.has(`${e}.${n}`))return Ms.get(`${e}.${n}`);const t=e.substring(2).toLowerCase(),u=Xb(Cv(t)),i=t.split("");for(let a=0;a<40;a+=2)u[a>>1]>>4>=8&&i[a]&&(i[a]=i[a].toUpperCase()),(u[a>>1]&15)>=8&&i[a+1]&&(i[a+1]=i[a+1].toUpperCase());const r=`0x${i.join("")}`;return Ms.set(`${e}.${n}`,r),r}async function ik(e,{address:n,blockTag:t="latest",blockNumber:u}){const i=await e.request({method:"eth_getTransactionCount",params:[n,typeof u=="bigint"?Vs(u):t]},{dedupe:!!u});return jb(i)}new gi(128),Vs(0,{size:32}),new gi(8192);var $t=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),bn=new Uint32Array(80),uk=class extends fi{constructor(){super(64,20,8,!1),this.A=$t[0]|0,this.B=$t[1]|0,this.C=$t[2]|0,this.D=$t[3]|0,this.E=$t[4]|0}get(){const{A:e,B:n,C:t,D:u,E:i}=this;return[e,n,t,u,i]}set(e,n,t,u,i){this.A=e|0,this.B=n|0,this.C=t|0,this.D=u|0,this.E=i|0}process(e,n){for(let o=0;o<16;o++,n+=4)bn[o]=e.getUint32(n,!1);for(let o=16;o<80;o++)bn[o]=dn(bn[o-3]^bn[o-8]^bn[o-14]^bn[o-16],1);let{A:t,B:u,C:i,D:r,E:a}=this;for(let o=0;o<80;o++){let s,c;o<20?(s=or(u,i,r),c=1518500249):o<40?(s=u^i^r,c=1859775393):o<60?(s=j4(u,i,r),c=2400959708):(s=u^i^r,c=3395469782);const l=dn(t,5)+s+a+c+bn[o]|0;a=r,r=i,i=dn(u,30),u=t,t=l}t=t+this.A|0,u=u+this.B|0,i=i+this.C|0,r=r+this.D|0,a=a+this.E|0,this.set(t,u,i,r,a)}roundClean(){Be(bn)}destroy(){this.set(0,0,0,0,0),Be(this.buffer)}};Je(()=>new uk);var rk=Math.pow(2,32),ak=Array.from({length:64},(e,n)=>Math.floor(rk*Math.abs(Math.sin(n+1)))),br=$t.slice(0,4),Gs=new Uint32Array(16),ok=class extends fi{constructor(){super(64,16,8,!0),this.A=br[0]|0,this.B=br[1]|0,this.C=br[2]|0,this.D=br[3]|0}get(){const{A:e,B:n,C:t,D:u}=this;return[e,n,t,u]}set(e,n,t,u){this.A=e|0,this.B=n|0,this.C=t|0,this.D=u|0}process(e,n){for(let a=0;a<16;a++,n+=4)Gs[a]=e.getUint32(n,!0);let{A:t,B:u,C:i,D:r}=this;for(let a=0;a<64;a++){let o,s,c;a<16?(o=or(u,i,r),s=a,c=[7,12,17,22]):a<32?(o=or(r,u,i),s=(5*a+1)%16,c=[5,9,14,20]):a<48?(o=u^i^r,s=(3*a+5)%16,c=[4,11,16,23]):(o=i^(u|~r),s=7*a%16,c=[6,10,15,21]),o=o+t+ak[a]+Gs[s],t=r,r=i,i=u,u=u+dn(o,c[a%4])}t=t+this.A|0,u=u+this.B|0,i=i+this.C|0,r=r+this.D|0,this.set(t,u,i,r)}roundClean(){Be(Gs)}destroy(){this.set(0,0,0,0),Be(this.buffer)}};Je(()=>new ok);var sk=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Pv=Uint8Array.from(new Array(16).fill(0).map((e,n)=>n)),ck=Pv.map(e=>(9*e+5)%16),Rv=(()=>{const t=[[Pv],[ck]];for(let u=0;u<4;u++)for(let i of t)i.push(i[u].map(r=>sk[r]));return t})(),jv=Rv[0],Lv=Rv[1],Zv=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),lk=jv.map((e,n)=>e.map(t=>Zv[n][t])),dk=Lv.map((e,n)=>e.map(t=>Zv[n][t])),fk=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),mk=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function Vv(e,n,t,u){return e===0?n^t^u:e===1?n&t|~n&u:e===2?(n|~t)^u:e===3?n&u|t&~u:n^(t|~u)}var kr=new Uint32Array(16),vk=class extends fi{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:n,h2:t,h3:u,h4:i}=this;return[e,n,t,u,i]}set(e,n,t,u,i){this.h0=e|0,this.h1=n|0,this.h2=t|0,this.h3=u|0,this.h4=i|0}process(e,n){for(let m=0;m<16;m++,n+=4)kr[m]=e.getUint32(n,!0);let t=this.h0|0,u=t,i=this.h1|0,r=i,a=this.h2|0,o=a,s=this.h3|0,c=s,l=this.h4|0,f=l;for(let m=0;m<5;m++){const d=4-m,v=fk[m],h=mk[m],b=jv[m],y=Lv[m],E=lk[m],k=dk[m];for(let _=0;_<16;_++){const B=dn(t+Vv(m,i,a,s)+kr[b[_]]+v,E[_])+l|0;t=l,l=s,s=dn(a,10)|0,a=i,i=B}for(let _=0;_<16;_++){const B=dn(u+Vv(d,r,o,c)+kr[y[_]]+h,k[_])+f|0;u=f,f=c,c=dn(o,10)|0,o=r,r=B}}this.set(this.h1+a+c|0,this.h2+s+f|0,this.h3+l+u|0,this.h4+t+r|0,this.h0+i+o|0)}roundClean(){Be(kr)}destroy(){this.destroyed=!0,Be(this.buffer),this.set(0,0,0,0,0)}};Je(()=>new vk);function pk(e){const{source:n}=e,t=new Map,u=new gi(8192),i=new Map,r=({address:a,chainId:o})=>`${a}.${o}`;return{async consume({address:a,chainId:o,client:s}){const c=r({address:a,chainId:o}),l=this.get({address:a,chainId:o,client:s});this.increment({address:a,chainId:o});const f=await l;return await n.set({address:a,chainId:o},f),u.set(c,f),f},async increment({address:a,chainId:o}){const s=r({address:a,chainId:o}),c=t.get(s)??0;t.set(s,c+1)},async get({address:a,chainId:o,client:s}){const c=r({address:a,chainId:o});let l=i.get(c);return l||(l=(async()=>{try{const m=await n.get({address:a,chainId:o,client:s}),d=u.get(c)??0;return d>0&&m<=d?d+1:(u.delete(c),m)}finally{this.reset({address:a,chainId:o})}})(),i.set(c,l)),(t.get(c)??0)+await l},reset({address:a,chainId:o}){const s=r({address:a,chainId:o});t.delete(s),i.delete(s)}}}function hk(){return{async get(e){const{address:n,client:t}=e;return ik(t,{address:n,blockTag:"pending"})},set(){}}}pk({source:hk()});function gk(e,n={}){const{as:t=typeof e=="string"?"Hex":"Bytes"}=n,u=zv(bb(e));return t==="Bytes"?u:kv(u)}var Ek=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const t=this.keys().next().value;t&&this.delete(t)}return this}},yk={checksum:new Ek(8192)},Js=yk.checksum,bk=/^0x[a-fA-F0-9]{40}$/;function qv(e,n={}){const{strict:t=!0}=n;if(!bk.test(e))throw new Mv({address:e,cause:new Dk});if(t){if(e.toLowerCase()===e)return;if(kk(e)!==e)throw new Mv({address:e,cause:new Sk})}}function kk(e){if(Js.has(e))return Js.get(e);qv(e,{strict:!1});const n=e.substring(2).toLowerCase(),t=gk(Sb(n),{as:"Bytes"}),u=n.split("");for(let r=0;r<40;r+=2)t[r>>1]>>4>=8&&u[r]&&(u[r]=u[r].toUpperCase()),(t[r>>1]&15)>=8&&u[r+1]&&(u[r+1]=u[r+1].toUpperCase());const i=`0x${u.join("")}`;return Js.set(e,i),i}var Mv=class extends Te{constructor({address:e,cause:n}){super(`Address "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},Dk=class extends Te{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},Sk=class extends Te{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}},Bk=/^(.*)\[([0-9]*)\]$/,wk=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ak=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Qs(e,n){if(e.length!==n.length)throw new Ck({expectedLength:e.length,givenLength:n.length});const t=[];for(let u=0;u<e.length;u++){const i=e[u],r=n[u];t.push(Qs.encode(i,r))}return bv(...t)}(function(e){function n(t,u,i=!1){if(t==="address"){const s=u;return qv(s),hr(s.toLowerCase(),i?32:0)}if(t==="string")return Fb(u);if(t==="bytes")return u;if(t==="bool")return hr($b(u),i?32:1);const r=t.match(Ak);if(r){const[s,c,l="256"]=r,f=Number.parseInt(l)/8;return xb(u,{size:i?32:f,signed:c==="int"})}const a=t.match(wk);if(a){const[s,c]=a;if(Number.parseInt(c)!==(u.length-2)/2)throw new _k({expectedSize:Number.parseInt(c),value:u});return Rs(u,i?32:0)}const o=t.match(Bk);if(o&&Array.isArray(u)){const[s,c]=o,l=[];for(let f=0;f<u.length;f++)l.push(n(c,u[f],!0));return l.length===0?"0x":bv(...l)}throw new $k(t)}e.encode=n})(Qs||(Qs={}));var _k=class extends Te{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${js(n)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}},Ck=class extends Te{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${e}`,`Given length (values): ${n}`].join(`
|
|
532
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},$k=class extends Te{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}};function xk(e){if(!/^0[xX][0-9a-fA-F]{40}$/.test(e))return!1;const n="0x"+e.slice(2),t=n.slice(2);return t===t.toLowerCase()||t===t.toUpperCase()?!0:nk(n)}function Gv(e){try{return new mp(e),!0}catch{return!1}}const Hs=e=>Math.round((e+Number.EPSILON)*100)/100;function Fk(e){const n=e.replace(/^data:\w+\/\w+;base64,/,""),t=Buffer.from(n,"base64");return new Uint8Array(t)}class Ik{client;constructor(n){this.client=n}async create(n){return(await this.client.query({query:kt,variables:{createDirectPaymentInput:{...n,amount:Hs(n.amount)}}}))?.createDirectPayment}async getWeb3PaymentParams(n){if(!xk(n.paymentTokenAddress))throw new Error("Invalid token address");return(await this.client.query({query:Ku,variables:{amount:Hs(n.paymentRequest.amountDue),network:n.paymentRequest.network,tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id}}))?.spritzPayParams}async getSolanaPaymentParams(n){if(!Gv(n.paymentTokenAddress))throw new Error(`Invalid token address: ${n.paymentTokenAddress}`);if(!Gv(n.signer))throw new Error(`Invalid signer: ${n.signer}`);const t=await this.client.query({query:Qu,variables:{amount:Hs(n.paymentRequest.amountDue),tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id,signer:n.signer}});return{versionedTransaction:vp.deserialize(Fk(t?.solanaParams?.transactionSerialized??"")),transactionSerialized:t?.solanaParams?.transactionSerialized}}}var
|
|
533
|
-
getKycLinkToken(enhancedVerification: true)
|
|
534
|
-
}
|
|
535
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function Sr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Sr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Sr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Sr(u,n)})}var Ks={};(function(){Dr.definitions.forEach(function(n){if(n.name){var t=new Set;Sr(n,t),Ks[n.name.value]=t}})})();function Jv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Nk(e,n){var t={kind:e.kind,definitions:[Jv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ks[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ks[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Jv(e,o);s&&t.definitions.push(s)}),t}Nk(Dr,"GetKycLinkToken");var xt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VerificationFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Verification"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"identity"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canRetry"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationMetadata"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"failureReason"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"details"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"matchedEmail"},arguments:[],directives:[]}]}}]}}]}}]}}],loc:{start:0,end:286}};xt.loc.source={body:`fragment VerificationFragment on Verification {
|
|
533
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},$k=class extends Te{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}};function xk(e){if(!/^0[xX][0-9a-fA-F]{40}$/.test(e))return!1;const n="0x"+e.slice(2),t=n.slice(2);return t===t.toLowerCase()||t===t.toUpperCase()?!0:nk(n)}function Gv(e){try{return new mp(e),!0}catch{return!1}}const Hs=e=>Math.round((e+Number.EPSILON)*100)/100;function Fk(e){const n=e.replace(/^data:\w+\/\w+;base64,/,""),t=Buffer.from(n,"base64");return new Uint8Array(t)}class Ik{client;constructor(n){this.client=n}async create(n){return(await this.client.query({query:kt,variables:{createDirectPaymentInput:{...n,amount:Hs(n.amount)}}}))?.createDirectPayment}async getWeb3PaymentParams(n){if(!xk(n.paymentTokenAddress))throw new Error("Invalid token address");return(await this.client.query({query:Ku,variables:{amount:Hs(n.paymentRequest.amountDue),network:n.paymentRequest.network,tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id}}))?.spritzPayParams}async getSolanaPaymentParams(n){if(!Gv(n.paymentTokenAddress))throw new Error(`Invalid token address: ${n.paymentTokenAddress}`);if(!Gv(n.signer))throw new Error(`Invalid signer: ${n.signer}`);const t=await this.client.query({query:Qu,variables:{amount:Hs(n.paymentRequest.amountDue),tokenAddress:n.paymentTokenAddress,reference:n.paymentRequest.id,signer:n.signer}});return{versionedTransaction:vp.deserialize(Fk(t?.solanaParams?.transactionSerialized??"")),transactionSerialized:t?.solanaParams?.transactionSerialized}}}var xt={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VerificationFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Verification"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"identity"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canRetry"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationMetadata"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"failureReason"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"details"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"matchedEmail"},arguments:[],directives:[]}]}}]}}]}}]}}],loc:{start:0,end:286}};xt.loc.source={body:`fragment VerificationFragment on Verification {
|
|
536
534
|
userId
|
|
537
535
|
identity {
|
|
538
536
|
canRetry
|
|
@@ -547,14 +545,22 @@ mutation CreatePaymentRequest($createDirectPaymentInput: CreateDirectPaymentInpu
|
|
|
547
545
|
}
|
|
548
546
|
}
|
|
549
547
|
}
|
|
550
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function
|
|
548
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function Dr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Dr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Dr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Dr(u,n)})}var Ks={};(function(){xt.definitions.forEach(function(n){if(n.name){var t=new Set;Dr(n,t),Ks[n.name.value]=t}})})();function Jv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Nk(e,n){var t={kind:e.kind,definitions:[Jv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ks[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ks[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Jv(e,o);s&&t.definitions.push(s)}),t}Nk(xt,"VerificationFragment");var Ft={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"RetryFailedVerification"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"retryFailedVerification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VerificationFragment"},directives:[]}]}}]}}],loc:{start:0,end:156}};Ft.loc.source={body:`#import "../queries/verificationFragment.graphql"
|
|
551
549
|
|
|
552
550
|
mutation RetryFailedVerification {
|
|
553
551
|
retryFailedVerification {
|
|
554
552
|
...VerificationFragment
|
|
555
553
|
}
|
|
556
554
|
}
|
|
557
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var
|
|
555
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Qv={};function Tk(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Qv[t]?!1:(Qv[t]=!0,!0)})}Ft.definitions=Ft.definitions.concat(Tk(xt.definitions));function Sr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Sr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Sr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Sr(u,n)})}var Ws={};(function(){Ft.definitions.forEach(function(n){if(n.name){var t=new Set;Sr(n,t),Ws[n.name.value]=t}})})();function Hv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Ok(e,n){var t={kind:e.kind,definitions:[Hv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ws[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ws[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Hv(e,o);s&&t.definitions.push(s)}),t}Ok(Ft,"RetryFailedVerification");var Br={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"GetVerificationParams"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getVerificationParams"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"inquiryId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sessionToken"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verificationUrlExpiresAt"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:165}};Br.loc.source={body:`mutation GetVerificationParams {
|
|
556
|
+
getVerificationParams {
|
|
557
|
+
inquiryId
|
|
558
|
+
verificationUrl
|
|
559
|
+
sessionToken
|
|
560
|
+
verificationUrlExpiresAt
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function wr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){wr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){wr(u,n)}),e.definitions&&e.definitions.forEach(function(u){wr(u,n)})}var Ys={};(function(){Br.definitions.forEach(function(n){if(n.name){var t=new Set;wr(n,t),Ys[n.name.value]=t}})})();function Kv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function zk(e,n){var t={kind:e.kind,definitions:[Kv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ys[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ys[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Kv(e,o);s&&t.definitions.push(s)}),t}zk(Br,"GetVerificationParams");var Ei={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"User"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"firstName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"timezone"},arguments:[],directives:[]}]}}],loc:{start:0,end:105}};Ei.loc.source={body:`fragment UserFragment on User {
|
|
558
564
|
id
|
|
559
565
|
email
|
|
560
566
|
firstName
|
|
@@ -594,7 +600,7 @@ query UserAccess {
|
|
|
594
600
|
hasAcceptedTos
|
|
595
601
|
}
|
|
596
602
|
}
|
|
597
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var np={};function tp(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return np[t]?!1:(np[t]=!0,!0)})}Dn.definitions=Dn.definitions.concat(tp(Ei.definitions)),Dn.definitions=Dn.definitions.concat(tp(xt.definitions));function Cr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Cr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Cr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Cr(u,n)})}var nc={};(function(){Dn.definitions.forEach(function(n){if(n.name){var t=new Set;Cr(n,t),nc[n.name.value]=t}})})();function ip(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Rk(e,n){var t={kind:e.kind,definitions:[ip(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=nc[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=nc[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=ip(e,o);s&&t.definitions.push(s)}),t}Rk(Dn,"UserAccess");var rn=(e=>(e.NotStarted="not_started",e.Pending="pending",e.Completed="completed",e.Failed="failed",e))(rn||{}),Oe=(e=>(e.IdentityVerification="identity_verification",e.TermsAcceptance="terms_acceptance",e.AdditionalVerification="additional_verification",e.RegionalCompliance="regional_compliance",e.RiskEvaluation="risk_evaluation",e.DocumentSubmission="document_submission",e))(Oe||{}),$r=(e=>(e.AchPurchase="ach_purchase",e.WirePurchase="wire_purchase",e))($r||{}),up=(e=>(e.UsBankAccount="us_bank_account",e.UsBills="us_bills",e.UsDebitCard="us_debit_card",e.IbanTransfer="iban_transfer",e.UkBankAccount="uk_bank_account",e.CaBankAccount="ca_bank_account",e))(up||{}),rp=(e=>(e.UsVirtualCard="us_virtual_card",e.UsPhysicalCard="us_physical_card",e))(rp||{}),jk=(e=>(e.VerifySms="verify_sms",e.DocumentVerification="documentary_verification",e.RiskCheck="risk_check",e.KycCheck="kyc_check",e.WatchlistScreening="watchlist_screening",e.SelfieCheck="selfie_check",e.AddressInvalid="address_invalid",e.DuplicateIdentity="duplicate_identity",e))(jk||{}),It=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(It||{});function Lk(e=rt.INITIALIZED){switch(e){case rt.FAILED:return"failed";case rt.ACTIVE:return"verified";case rt.DISABLED:return"disabled";case rt.RETRY:return"failed";default:return"not_started"}}function ap(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:Lk(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}function Zk(e,n){return{verified:e===It.Verified,country:n??null}}function Vk({verificationUrl:e,verificationStatus:n,retryable:t}){if(n!==It.Verified)return n===It.Failed?{type:Oe.IdentityVerification,description:"Identity verification failed. Please retry verification.",retryable:t,status:rn.Failed}:n===It.NotStarted?{type:Oe.IdentityVerification,description:"Verify your identity to unlock features",actionUrl:e,status:rn.NotStarted}:{type:Oe.IdentityVerification,description:"Identity verification pending review",status:rn.Pending}}function qk(e){try{const n=new URL(e);return n.searchParams.delete("redirect_uri"),n.toString()}catch{return e}}function Mk(e,n){if(!e&&n)return{type:Oe.TermsAcceptance,description:"Please review and accept the terms of service",actionUrl:qk(n),status:rn.NotStarted}}function Gk(e){if(!e)return{type:Oe.IdentityVerification,status:rn.NotStarted};if(!(e.status==="active"||e.status==="approved"))return e.status==="rejected"||e.status==="failed"?{type:Oe.IdentityVerification,status:rn.Failed}:e.status==="pending"||e.status==="in_review"?{type:Oe.IdentityVerification,status:rn.Pending}:{type:Oe.IdentityVerification,status:rn.NotStarted}}function Jk(e){if(!e)return[];if(!["US"].includes(e.toUpperCase()))return[];const n=[];return e.toUpperCase()==="US"&&n.push($r.AchPurchase,$r.WirePurchase),n}function Qk(e,n){const t=Jk(e.country??null);if(!e.verified)return{active:!1,features:[],requirements:[]};const u=[],i=Mk(n?.hasAcceptedTos??!1,n?.tosLink);i&&u.push(i);const r=Gk(n);if(r&&u.push(r),t.length===0)return{active:!1,features:[],requirements:u};const a={active:u.length===0,features:u.length===0?t:[],requirements:u};return i?a.nextRequirement=Oe.TermsAcceptance:r&&(a.nextRequirement=Oe.IdentityVerification),a}function Hk(e,n,t){const u=e?.bridgeUser,i=e?.verification?.identity?.canRetry??!1,r=e?.verification?.identity?.verificationUrl??null,a=Zk(n,t),o=Vk({verificationStatus:n,retryable:i,verificationUrl:r}),s={onramp:Qk(a,u)};return{kycStatus:a,...o&&{kycRequirement:o},capabilities:s}}class Kk{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:kn});return ap(n)}async retryFailedVerification(){return await this.client.query({query:Ft}),this.getCurrentUser()}async
|
|
603
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var np={};function tp(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return np[t]?!1:(np[t]=!0,!0)})}Dn.definitions=Dn.definitions.concat(tp(Ei.definitions)),Dn.definitions=Dn.definitions.concat(tp(xt.definitions));function Cr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){Cr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){Cr(u,n)}),e.definitions&&e.definitions.forEach(function(u){Cr(u,n)})}var nc={};(function(){Dn.definitions.forEach(function(n){if(n.name){var t=new Set;Cr(n,t),nc[n.name.value]=t}})})();function ip(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Rk(e,n){var t={kind:e.kind,definitions:[ip(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=nc[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=nc[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=ip(e,o);s&&t.definitions.push(s)}),t}Rk(Dn,"UserAccess");var rn=(e=>(e.NotStarted="not_started",e.Pending="pending",e.Completed="completed",e.Failed="failed",e))(rn||{}),Oe=(e=>(e.IdentityVerification="identity_verification",e.TermsAcceptance="terms_acceptance",e.AdditionalVerification="additional_verification",e.RegionalCompliance="regional_compliance",e.RiskEvaluation="risk_evaluation",e.DocumentSubmission="document_submission",e))(Oe||{}),$r=(e=>(e.AchPurchase="ach_purchase",e.WirePurchase="wire_purchase",e))($r||{}),up=(e=>(e.UsBankAccount="us_bank_account",e.UsBills="us_bills",e.UsDebitCard="us_debit_card",e.IbanTransfer="iban_transfer",e.UkBankAccount="uk_bank_account",e.CaBankAccount="ca_bank_account",e))(up||{}),rp=(e=>(e.UsVirtualCard="us_virtual_card",e.UsPhysicalCard="us_physical_card",e))(rp||{}),jk=(e=>(e.VerifySms="verify_sms",e.DocumentVerification="documentary_verification",e.RiskCheck="risk_check",e.KycCheck="kyc_check",e.WatchlistScreening="watchlist_screening",e.SelfieCheck="selfie_check",e.AddressInvalid="address_invalid",e.DuplicateIdentity="duplicate_identity",e))(jk||{}),It=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(It||{});function Lk(e=rt.INITIALIZED){switch(e){case rt.FAILED:return"failed";case rt.ACTIVE:return"verified";case rt.DISABLED:return"disabled";case rt.RETRY:return"failed";default:return"not_started"}}function ap(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:Lk(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}function Zk(e,n){return{verified:e===It.Verified,country:n??null}}function Vk({verificationUrl:e,verificationStatus:n,retryable:t}){if(n!==It.Verified)return n===It.Failed?{type:Oe.IdentityVerification,description:"Identity verification failed. Please retry verification.",retryable:t,status:rn.Failed}:n===It.NotStarted?{type:Oe.IdentityVerification,description:"Verify your identity to unlock features",actionUrl:e,status:rn.NotStarted}:{type:Oe.IdentityVerification,description:"Identity verification pending review",status:rn.Pending}}function qk(e){try{const n=new URL(e);return n.searchParams.delete("redirect_uri"),n.toString()}catch{return e}}function Mk(e,n){if(!e&&n)return{type:Oe.TermsAcceptance,description:"Please review and accept the terms of service",actionUrl:qk(n),status:rn.NotStarted}}function Gk(e){if(!e)return{type:Oe.IdentityVerification,status:rn.NotStarted};if(!(e.status==="active"||e.status==="approved"))return e.status==="rejected"||e.status==="failed"?{type:Oe.IdentityVerification,status:rn.Failed}:e.status==="pending"||e.status==="in_review"?{type:Oe.IdentityVerification,status:rn.Pending}:{type:Oe.IdentityVerification,status:rn.NotStarted}}function Jk(e){if(!e)return[];if(!["US"].includes(e.toUpperCase()))return[];const n=[];return e.toUpperCase()==="US"&&n.push($r.AchPurchase,$r.WirePurchase),n}function Qk(e,n){const t=Jk(e.country??null);if(!e.verified)return{active:!1,features:[],requirements:[]};const u=[],i=Mk(n?.hasAcceptedTos??!1,n?.tosLink);i&&u.push(i);const r=Gk(n);if(r&&u.push(r),t.length===0)return{active:!1,features:[],requirements:u};const a={active:u.length===0,features:u.length===0?t:[],requirements:u};return i?a.nextRequirement=Oe.TermsAcceptance:r&&(a.nextRequirement=Oe.IdentityVerification),a}function Hk(e,n,t){const u=e?.bridgeUser,i=e?.verification?.identity?.canRetry??!1,r=e?.verification?.identity?.verificationUrl??null,a=Zk(n,t),o=Vk({verificationStatus:n,retryable:i,verificationUrl:r}),s={onramp:Qk(a,u)};return{kycStatus:a,...o&&{kycRequirement:o},capabilities:s}}class Kk{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:kn});return ap(n)}async retryFailedVerification(){return await this.client.query({query:Ft}),this.getCurrentUser()}async getVerificationParams(){return(await this.client.query({query:Br})).getVerificationParams}async getUserAccess(){const n=await this.client.query({query:Dn}),t=ap(n),u=t?.verificationStatus??It.NotStarted,i=t?.verifiedCountry??null;return Hk(n,u,i)}}var yi={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:469}};yi.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
|
|
598
604
|
id
|
|
599
605
|
name
|
|
600
606
|
userId
|