@portal-hq/web 3.17.0 → 3.18.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +62 -20
- package/lib/commonjs/index.test.js +51 -10
- package/lib/commonjs/integrations/ramps/index.js +2 -0
- package/lib/commonjs/integrations/ramps/meld/index.js +121 -0
- package/lib/commonjs/integrations/ramps/meld/index.test.js +162 -0
- package/lib/commonjs/integrations/ramps/noah/index.js +2 -2
- package/lib/commonjs/integrations/ramps/noah/index.test.js +11 -2
- package/lib/commonjs/mpc/index.js +199 -3
- package/lib/commonjs/mpc/index.test.js +634 -0
- package/lib/commonjs/provider/index.js +44 -2
- package/lib/commonjs/provider/index.test.js +186 -0
- package/lib/commonjs/rpc.test.js +162 -0
- package/lib/commonjs/shared/rpc/auth.js +29 -0
- package/lib/commonjs/shared/rpc/defaults.js +40 -0
- package/lib/commonjs/shared/types/index.js +1 -0
- package/lib/commonjs/shared/types/meld.js +2 -0
- package/lib/esm/index.js +59 -19
- package/lib/esm/index.test.js +51 -10
- package/lib/esm/integrations/ramps/index.js +2 -0
- package/lib/esm/integrations/ramps/meld/index.js +118 -0
- package/lib/esm/integrations/ramps/meld/index.test.js +157 -0
- package/lib/esm/integrations/ramps/noah/index.js +2 -2
- package/lib/esm/integrations/ramps/noah/index.test.js +11 -2
- package/lib/esm/mpc/index.js +199 -3
- package/lib/esm/mpc/index.test.js +635 -1
- package/lib/esm/provider/index.js +44 -2
- package/lib/esm/provider/index.test.js +186 -0
- package/lib/esm/rpc.test.js +157 -0
- package/lib/esm/shared/rpc/auth.js +25 -0
- package/lib/esm/shared/rpc/defaults.js +36 -0
- package/lib/esm/shared/types/index.js +1 -0
- package/lib/esm/shared/types/meld.js +1 -0
- package/noah-types.d.ts +17 -1
- package/package.json +3 -2
- package/src/__mocks/constants.ts +68 -0
- package/src/__mocks/portal/portal.ts +0 -1
- package/src/index.test.ts +90 -0
- package/src/index.ts +159 -7
- package/src/integrations/ramps/index.ts +3 -0
- package/src/integrations/ramps/meld/index.test.ts +189 -0
- package/src/integrations/ramps/meld/index.ts +149 -0
- package/src/integrations/ramps/noah/index.test.ts +11 -2
- package/src/integrations/ramps/noah/index.ts +5 -2
- package/src/mpc/index.test.ts +804 -7
- package/src/mpc/index.ts +247 -3
- package/src/provider/index.test.ts +233 -0
- package/src/provider/index.ts +64 -1
- package/src/rpc.test.ts +190 -0
- package/src/shared/rpc/auth.ts +27 -0
- package/src/shared/rpc/defaults.ts +41 -0
- package/src/shared/types/common.ts +24 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/meld.ts +302 -0
- package/src/shared/types/noah.ts +191 -29
- package/types.d.ts +65 -3
package/src/__mocks/constants.ts
CHANGED
|
@@ -2092,6 +2092,74 @@ export const mockUpgradeTo7702Response = {
|
|
|
2092
2092
|
txHash: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
2093
2093
|
} as UpgradeTo7702Response
|
|
2094
2094
|
|
|
2095
|
+
// Meld mock data
|
|
2096
|
+
export const mockMeldCreateCustomerRequest = {
|
|
2097
|
+
email: 'user@example.com',
|
|
2098
|
+
type: 'INDIVIDUAL' as const,
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
export const mockMeldCreateCustomerResponse = {
|
|
2102
|
+
data: { id: 'cust-1', accountId: 'acc-1', externalId: 'ext-1', email: 'user@example.com' },
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
export const mockMeldSearchCustomerResponse = {
|
|
2106
|
+
data: { customers: [], count: 0, remaining: 0 },
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
export const mockMeldGetRetailQuoteRequest = {
|
|
2110
|
+
countryCode: 'US',
|
|
2111
|
+
sourceCurrencyCode: 'USD',
|
|
2112
|
+
destinationCurrencyCode: 'ETH',
|
|
2113
|
+
sourceAmount: 100,
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
export const mockMeldGetRetailQuoteResponse = {
|
|
2117
|
+
data: { quotes: [] },
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
export const mockMeldCreateRetailWidgetRequest = {
|
|
2121
|
+
sessionType: 'BUY' as const,
|
|
2122
|
+
sessionData: {
|
|
2123
|
+
countryCode: 'US',
|
|
2124
|
+
serviceProvider: 'STRIPE',
|
|
2125
|
+
sourceCurrencyCode: 'USD',
|
|
2126
|
+
sourceAmount: '100',
|
|
2127
|
+
destinationCurrencyCode: 'ETH',
|
|
2128
|
+
},
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
export const mockMeldCreateRetailWidgetResponse = {
|
|
2132
|
+
data: {
|
|
2133
|
+
id: 'sess-1',
|
|
2134
|
+
token: 'tok-1',
|
|
2135
|
+
customerId: 'cust-1',
|
|
2136
|
+
externalCustomerId: 'ext-cust-1',
|
|
2137
|
+
externalSessionId: 'ext-ses-1',
|
|
2138
|
+
widgetUrl: 'https://widget.meld.io/sess-1',
|
|
2139
|
+
},
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
export const mockMeldSearchRetailTransactionsResponse = {
|
|
2143
|
+
data: { transactions: [], count: 0, remaining: 0, totalCount: 0 },
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
export const mockMeldGetRetailTransactionResponse = {
|
|
2147
|
+
data: {
|
|
2148
|
+
transaction: {
|
|
2149
|
+
id: 'tx-1',
|
|
2150
|
+
sessionId: 'ses-1',
|
|
2151
|
+
status: 'COMPLETED',
|
|
2152
|
+
transactionType: 'BUY',
|
|
2153
|
+
serviceProvider: 'STRIPE',
|
|
2154
|
+
createdAt: '2024-01-01T00:00:00Z',
|
|
2155
|
+
updatedAt: '2024-01-01T00:00:00Z',
|
|
2156
|
+
},
|
|
2157
|
+
},
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
export const mockMeldDiscoveryResponse = { data: [] }
|
|
2161
|
+
|
|
2162
|
+
export const mockMeldDiscoveryParams = { countries: 'US' }
|
|
2095
2163
|
export const mockBuildBatchedUserOpRequest = {
|
|
2096
2164
|
chain: 'eip155:1',
|
|
2097
2165
|
calls: [
|
package/src/index.test.ts
CHANGED
|
@@ -100,6 +100,7 @@ describe('Portal', () => {
|
|
|
100
100
|
featureFlags: {},
|
|
101
101
|
},
|
|
102
102
|
mockProgressFn,
|
|
103
|
+
undefined,
|
|
103
104
|
)
|
|
104
105
|
})
|
|
105
106
|
|
|
@@ -124,6 +125,19 @@ describe('Portal', () => {
|
|
|
124
125
|
featureFlags: { isMultiBackupEnabled: true },
|
|
125
126
|
},
|
|
126
127
|
mockProgressFn,
|
|
128
|
+
undefined,
|
|
129
|
+
)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('should pass caller-supplied traceId to mpc.generate', async () => {
|
|
133
|
+
const mockProgressFn = jest.fn()
|
|
134
|
+
const callerTraceId = 'test-trace-id-create'
|
|
135
|
+
await portal.createWallet(mockProgressFn, callerTraceId)
|
|
136
|
+
|
|
137
|
+
expect(portal.mpc.generate).toHaveBeenCalledWith(
|
|
138
|
+
expect.any(Object),
|
|
139
|
+
mockProgressFn,
|
|
140
|
+
callerTraceId,
|
|
127
141
|
)
|
|
128
142
|
})
|
|
129
143
|
})
|
|
@@ -148,6 +162,7 @@ describe('Portal', () => {
|
|
|
148
162
|
featureFlags: {},
|
|
149
163
|
},
|
|
150
164
|
mockProgressFn,
|
|
165
|
+
undefined,
|
|
151
166
|
)
|
|
152
167
|
})
|
|
153
168
|
|
|
@@ -178,6 +193,24 @@ describe('Portal', () => {
|
|
|
178
193
|
featureFlags: { isMultiBackupEnabled: true },
|
|
179
194
|
},
|
|
180
195
|
mockProgressFn,
|
|
196
|
+
undefined,
|
|
197
|
+
)
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
it('should pass caller-supplied traceId to mpc.backup', async () => {
|
|
201
|
+
const mockProgressFn = jest.fn()
|
|
202
|
+
const callerTraceId = 'test-trace-id-backup'
|
|
203
|
+
await portal.backupWallet(
|
|
204
|
+
BackupMethods.gdrive,
|
|
205
|
+
mockProgressFn,
|
|
206
|
+
mockBackupConfig,
|
|
207
|
+
callerTraceId,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
expect(portal.mpc.backup).toHaveBeenCalledWith(
|
|
211
|
+
expect.any(Object),
|
|
212
|
+
mockProgressFn,
|
|
213
|
+
callerTraceId,
|
|
181
214
|
)
|
|
182
215
|
})
|
|
183
216
|
})
|
|
@@ -209,6 +242,7 @@ describe('Portal', () => {
|
|
|
209
242
|
featureFlags: {},
|
|
210
243
|
},
|
|
211
244
|
expect.any(Function),
|
|
245
|
+
undefined,
|
|
212
246
|
)
|
|
213
247
|
})
|
|
214
248
|
|
|
@@ -222,6 +256,22 @@ describe('Portal', () => {
|
|
|
222
256
|
'Passkey backup did not return an encryption key',
|
|
223
257
|
)
|
|
224
258
|
})
|
|
259
|
+
|
|
260
|
+
it('should pass caller-supplied traceId to mpc.backup', async () => {
|
|
261
|
+
const callerTraceId = 'test-trace-id-gen-backup'
|
|
262
|
+
;(portal.mpc.backup as jest.Mock).mockResolvedValueOnce({
|
|
263
|
+
cipherText: mockCipherText,
|
|
264
|
+
encryptionKey: 'manual-key',
|
|
265
|
+
storageCallback: jest.fn(),
|
|
266
|
+
})
|
|
267
|
+
await portal.generateBackupShare(undefined, callerTraceId)
|
|
268
|
+
|
|
269
|
+
expect(portal.mpc.backup).toHaveBeenCalledWith(
|
|
270
|
+
expect.any(Object),
|
|
271
|
+
expect.any(Function),
|
|
272
|
+
callerTraceId,
|
|
273
|
+
)
|
|
274
|
+
})
|
|
225
275
|
})
|
|
226
276
|
|
|
227
277
|
describe('registerPasskeyAndStoreEncryptionKey', () => {
|
|
@@ -356,6 +406,7 @@ describe('Portal', () => {
|
|
|
356
406
|
featureFlags: {},
|
|
357
407
|
},
|
|
358
408
|
progress,
|
|
409
|
+
undefined,
|
|
359
410
|
)
|
|
360
411
|
})
|
|
361
412
|
})
|
|
@@ -382,6 +433,7 @@ describe('Portal', () => {
|
|
|
382
433
|
featureFlags: {},
|
|
383
434
|
},
|
|
384
435
|
mockProgressFn,
|
|
436
|
+
undefined,
|
|
385
437
|
)
|
|
386
438
|
})
|
|
387
439
|
|
|
@@ -414,6 +466,25 @@ describe('Portal', () => {
|
|
|
414
466
|
featureFlags: { isMultiBackupEnabled: true },
|
|
415
467
|
},
|
|
416
468
|
mockProgressFn,
|
|
469
|
+
undefined,
|
|
470
|
+
)
|
|
471
|
+
})
|
|
472
|
+
|
|
473
|
+
it('should pass caller-supplied traceId to mpc.recover', async () => {
|
|
474
|
+
const mockProgressFn = jest.fn()
|
|
475
|
+
const callerTraceId = 'test-trace-id-recover'
|
|
476
|
+
await portal.recoverWallet(
|
|
477
|
+
mockCipherText,
|
|
478
|
+
BackupMethods.password,
|
|
479
|
+
mockBackupConfig,
|
|
480
|
+
mockProgressFn,
|
|
481
|
+
callerTraceId,
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
expect(portal.mpc.recover).toHaveBeenCalledWith(
|
|
485
|
+
expect.any(Object),
|
|
486
|
+
mockProgressFn,
|
|
487
|
+
callerTraceId,
|
|
417
488
|
)
|
|
418
489
|
})
|
|
419
490
|
})
|
|
@@ -440,6 +511,7 @@ describe('Portal', () => {
|
|
|
440
511
|
featureFlags: {},
|
|
441
512
|
},
|
|
442
513
|
mockProgressFn,
|
|
514
|
+
undefined,
|
|
443
515
|
)
|
|
444
516
|
})
|
|
445
517
|
|
|
@@ -472,6 +544,7 @@ describe('Portal', () => {
|
|
|
472
544
|
featureFlags: { isMultiBackupEnabled: true },
|
|
473
545
|
},
|
|
474
546
|
mockProgressFn,
|
|
547
|
+
undefined,
|
|
475
548
|
)
|
|
476
549
|
})
|
|
477
550
|
})
|
|
@@ -1715,4 +1788,21 @@ describe('Portal', () => {
|
|
|
1715
1788
|
expect(portal.iframeRpcConfig).toEqual(iframeRpcConfig)
|
|
1716
1789
|
})
|
|
1717
1790
|
})
|
|
1791
|
+
|
|
1792
|
+
describe('onWalletNotOnDevice', () => {
|
|
1793
|
+
it('returns an unsubscribe function that stops the callback from firing', () => {
|
|
1794
|
+
const callback = jest.fn()
|
|
1795
|
+
const unsubscribe = portal.onWalletNotOnDevice(callback)
|
|
1796
|
+
|
|
1797
|
+
unsubscribe()
|
|
1798
|
+
|
|
1799
|
+
portal.triggerWalletNotOnDevice({
|
|
1800
|
+
clientId: 'test-client',
|
|
1801
|
+
isBackedUp: false,
|
|
1802
|
+
reason: 'storage_cleared',
|
|
1803
|
+
})
|
|
1804
|
+
|
|
1805
|
+
expect(callback).not.toHaveBeenCalled()
|
|
1806
|
+
})
|
|
1807
|
+
})
|
|
1718
1808
|
})
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,7 @@ import {
|
|
|
59
59
|
type PasskeyOptions,
|
|
60
60
|
type PortalOptions,
|
|
61
61
|
type FirebaseStorageConfigOptions,
|
|
62
|
+
type WalletNotOnDevicePayload,
|
|
62
63
|
} from '../types'
|
|
63
64
|
import Mpc from './mpc'
|
|
64
65
|
import Provider, { RequestMethod } from './provider'
|
|
@@ -71,6 +72,7 @@ import PasskeyService from './passkeys'
|
|
|
71
72
|
import { EvmAccountType } from './namespaces/evmAccountType'
|
|
72
73
|
import { sdkLogger } from './logger'
|
|
73
74
|
import { generateTraceId } from './shared/trace'
|
|
75
|
+
import { buildDefaultRpcConfig, DEFAULT_RPC_HOST } from './shared/rpc/defaults'
|
|
74
76
|
import { waitForEvmOrUserOpConfirmation } from './internal/waitForEvmOrUserOpConfirmation'
|
|
75
77
|
import { waitForSolanaTxConfirmation } from './internal/waitForSolanaTxConfirmation'
|
|
76
78
|
import type { LogLevel, ILogger } from '../types'
|
|
@@ -100,6 +102,8 @@ class Portal {
|
|
|
100
102
|
private _rpcConfig: RpcConfig
|
|
101
103
|
private _iframeRpcConfig?: RpcConfig
|
|
102
104
|
private readyCallbacks: (() => any | Promise<any>)[] = []
|
|
105
|
+
private walletNotOnDeviceCallbacks: ((payload: WalletNotOnDevicePayload) => any | Promise<any>)[] = []
|
|
106
|
+
private lastWalletNotOnDevicePayload: WalletNotOnDevicePayload | null = null
|
|
103
107
|
private passkeyService?: PasskeyService
|
|
104
108
|
private passkeyServiceDefaultDomain?: string
|
|
105
109
|
private logger: ILogger = console
|
|
@@ -117,8 +121,9 @@ class Portal {
|
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
constructor({
|
|
120
|
-
//
|
|
124
|
+
// Optional — defaults to Portal-managed RPC gateway when omitted or empty
|
|
121
125
|
rpcConfig,
|
|
126
|
+
gatewayHost,
|
|
122
127
|
|
|
123
128
|
// Optional
|
|
124
129
|
iframeRpcConfig,
|
|
@@ -128,7 +133,7 @@ class Portal {
|
|
|
128
133
|
autoApprove = false,
|
|
129
134
|
gdrive,
|
|
130
135
|
passkey,
|
|
131
|
-
host =
|
|
136
|
+
host = DEFAULT_RPC_HOST,
|
|
132
137
|
mpcVersion = 'v6',
|
|
133
138
|
mpcHost = 'mpc-client.portalhq.io',
|
|
134
139
|
featureFlags = {},
|
|
@@ -136,11 +141,30 @@ class Portal {
|
|
|
136
141
|
logLevel = 'none',
|
|
137
142
|
logger = console,
|
|
138
143
|
}: PortalOptions) {
|
|
144
|
+
// Gateway host resolution — three-level priority:
|
|
145
|
+
// 1. gatewayHost (explicit override)
|
|
146
|
+
// 2. host (environment identity: 'web.portalhq.io' prod / 'web.portalhq.dev' staging)
|
|
147
|
+
// 3. DEFAULT_RPC_HOST (compile-time production fallback)
|
|
148
|
+
//
|
|
149
|
+
// `host` doubles as the RPC gateway domain in Portal deployments — the two are
|
|
150
|
+
// always on the same hostname per environment (confirmed in deploy configs).
|
|
151
|
+
// Deriving from `host` ensures staging callers don't silently RPC to production
|
|
152
|
+
// when only `host` is overridden. Explicit `gatewayHost` takes full precedence
|
|
153
|
+
// for custom domains or non-standard deployments.
|
|
154
|
+
const effectiveGatewayHost = gatewayHost ?? host
|
|
155
|
+
|
|
156
|
+
// Resolve rpcConfig: undefined or {} → auto-generate from effectiveGatewayHost.
|
|
157
|
+
// An explicit non-empty map is used verbatim — no merging with defaults.
|
|
158
|
+
const resolvedRpcConfig: RpcConfig =
|
|
159
|
+
!rpcConfig || Object.keys(rpcConfig).length === 0
|
|
160
|
+
? buildDefaultRpcConfig(effectiveGatewayHost)
|
|
161
|
+
: rpcConfig
|
|
162
|
+
|
|
139
163
|
this.apiKey = apiKey
|
|
140
164
|
this.authToken = authToken
|
|
141
165
|
this.authUrl = authUrl
|
|
142
166
|
this.autoApprove = autoApprove
|
|
143
|
-
this._rpcConfig =
|
|
167
|
+
this._rpcConfig = resolvedRpcConfig
|
|
144
168
|
this._iframeRpcConfig = iframeRpcConfig
|
|
145
169
|
this.host = host
|
|
146
170
|
this.mpcHost = mpcHost
|
|
@@ -287,6 +311,37 @@ class Portal {
|
|
|
287
311
|
}
|
|
288
312
|
}
|
|
289
313
|
|
|
314
|
+
public onWalletNotOnDevice(
|
|
315
|
+
callback: (payload: WalletNotOnDevicePayload) => any | Promise<any>,
|
|
316
|
+
): () => void {
|
|
317
|
+
// Replay to late subscribers: if the event already fired, deliver immediately.
|
|
318
|
+
if (this.lastWalletNotOnDevicePayload !== null) {
|
|
319
|
+
const cached = this.lastWalletNotOnDevicePayload
|
|
320
|
+
Promise.resolve()
|
|
321
|
+
.then(() => callback(cached))
|
|
322
|
+
.catch((err) =>
|
|
323
|
+
sdkLogger.warn('[Portal] onWalletNotOnDevice callback failed:', err),
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
this.walletNotOnDeviceCallbacks.push(callback)
|
|
327
|
+
return () => {
|
|
328
|
+
this.walletNotOnDeviceCallbacks = this.walletNotOnDeviceCallbacks.filter(
|
|
329
|
+
(cb) => cb !== callback,
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
public triggerWalletNotOnDevice(payload: WalletNotOnDevicePayload) {
|
|
335
|
+
this.lastWalletNotOnDevicePayload = payload
|
|
336
|
+
this.walletNotOnDeviceCallbacks.forEach((callback) => {
|
|
337
|
+
Promise.resolve()
|
|
338
|
+
.then(() => callback(payload))
|
|
339
|
+
.catch((err) =>
|
|
340
|
+
sdkLogger.warn('[Portal] onWalletNotOnDevice callback failed:', err),
|
|
341
|
+
)
|
|
342
|
+
})
|
|
343
|
+
}
|
|
344
|
+
|
|
290
345
|
/*****************************
|
|
291
346
|
* Wallet Methods
|
|
292
347
|
*****************************/
|
|
@@ -299,6 +354,7 @@ class Portal {
|
|
|
299
354
|
progress: ProgressCallback = () => {
|
|
300
355
|
// Noop
|
|
301
356
|
},
|
|
357
|
+
traceId?: string,
|
|
302
358
|
): Promise<string> {
|
|
303
359
|
const address = await this.mpc.generate(
|
|
304
360
|
{
|
|
@@ -307,6 +363,7 @@ class Portal {
|
|
|
307
363
|
featureFlags: this.featureFlags,
|
|
308
364
|
},
|
|
309
365
|
progress,
|
|
366
|
+
traceId,
|
|
310
367
|
)
|
|
311
368
|
|
|
312
369
|
this.address = address
|
|
@@ -318,6 +375,7 @@ class Portal {
|
|
|
318
375
|
progress: ProgressCallback = () => {
|
|
319
376
|
// Noop
|
|
320
377
|
},
|
|
378
|
+
traceId?: string,
|
|
321
379
|
): Promise<BackupShareResult> {
|
|
322
380
|
const response = await this.mpc.backup(
|
|
323
381
|
{
|
|
@@ -330,6 +388,7 @@ class Portal {
|
|
|
330
388
|
featureFlags: this.featureFlags,
|
|
331
389
|
},
|
|
332
390
|
progress,
|
|
391
|
+
traceId,
|
|
333
392
|
)
|
|
334
393
|
|
|
335
394
|
if (!response.encryptionKey) {
|
|
@@ -413,6 +472,7 @@ class Portal {
|
|
|
413
472
|
progress: ProgressCallback = () => {
|
|
414
473
|
// Noop
|
|
415
474
|
},
|
|
475
|
+
traceId?: string,
|
|
416
476
|
): Promise<void> {
|
|
417
477
|
const {
|
|
418
478
|
usePopup = true,
|
|
@@ -422,7 +482,7 @@ class Portal {
|
|
|
422
482
|
} = options
|
|
423
483
|
|
|
424
484
|
if (usePopup) {
|
|
425
|
-
await this.backupWallet(backupMethod, progress, {})
|
|
485
|
+
await this.backupWallet(backupMethod, progress, {}, traceId)
|
|
426
486
|
return
|
|
427
487
|
}
|
|
428
488
|
|
|
@@ -434,6 +494,7 @@ class Portal {
|
|
|
434
494
|
|
|
435
495
|
const { cipherText, encryptionKey } = await this.generateBackupShare(
|
|
436
496
|
progress,
|
|
497
|
+
traceId,
|
|
437
498
|
)
|
|
438
499
|
|
|
439
500
|
await this.registerPasskeyAndStoreEncryptionKey(cipherText, encryptionKey, {
|
|
@@ -457,6 +518,7 @@ class Portal {
|
|
|
457
518
|
// Noop
|
|
458
519
|
},
|
|
459
520
|
backupConfigs: BackupConfigs = {},
|
|
521
|
+
traceId?: string,
|
|
460
522
|
): Promise<BackupResponse> {
|
|
461
523
|
const response = await this.mpc.backup(
|
|
462
524
|
{
|
|
@@ -467,6 +529,7 @@ class Portal {
|
|
|
467
529
|
featureFlags: this.featureFlags,
|
|
468
530
|
},
|
|
469
531
|
progress,
|
|
532
|
+
traceId,
|
|
470
533
|
)
|
|
471
534
|
|
|
472
535
|
return response
|
|
@@ -479,6 +542,7 @@ class Portal {
|
|
|
479
542
|
progress: ProgressCallback = () => {
|
|
480
543
|
// Noop
|
|
481
544
|
},
|
|
545
|
+
traceId?: string,
|
|
482
546
|
): Promise<string> {
|
|
483
547
|
const address = await this.mpc.recover(
|
|
484
548
|
{
|
|
@@ -490,6 +554,7 @@ class Portal {
|
|
|
490
554
|
featureFlags: this.featureFlags,
|
|
491
555
|
},
|
|
492
556
|
progress,
|
|
557
|
+
traceId,
|
|
493
558
|
)
|
|
494
559
|
|
|
495
560
|
this.address = address
|
|
@@ -504,8 +569,15 @@ class Portal {
|
|
|
504
569
|
progress: ProgressCallback = () => {
|
|
505
570
|
// Noop
|
|
506
571
|
},
|
|
572
|
+
traceId?: string,
|
|
507
573
|
): Promise<string> {
|
|
508
|
-
return this.recoverWallet(
|
|
574
|
+
return this.recoverWallet(
|
|
575
|
+
cipherText,
|
|
576
|
+
backupMethod,
|
|
577
|
+
backupConfigs,
|
|
578
|
+
progress,
|
|
579
|
+
traceId,
|
|
580
|
+
)
|
|
509
581
|
}
|
|
510
582
|
|
|
511
583
|
public async eject(
|
|
@@ -1842,9 +1914,8 @@ class Portal {
|
|
|
1842
1914
|
ethereum: 'eip155:1',
|
|
1843
1915
|
sepolia: 'eip155:11155111',
|
|
1844
1916
|
base: 'eip155:8453',
|
|
1845
|
-
'base-sepolia': 'eip155:
|
|
1917
|
+
'base-sepolia': 'eip155:84532',
|
|
1846
1918
|
polygon: 'eip155:137',
|
|
1847
|
-
'polygon-mumbai': 'eip155:80001',
|
|
1848
1919
|
'polygon-amoy': 'eip155:80002',
|
|
1849
1920
|
solana: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
1850
1921
|
'solana-devnet': 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
@@ -2008,6 +2079,23 @@ export {
|
|
|
2008
2079
|
} from './shared/types'
|
|
2009
2080
|
|
|
2010
2081
|
export type {
|
|
2082
|
+
AccountHolderDetails,
|
|
2083
|
+
AccountHolderName,
|
|
2084
|
+
AmountCondition,
|
|
2085
|
+
BankDetails,
|
|
2086
|
+
BankToAddressRelatedPaymentMethod,
|
|
2087
|
+
Channel,
|
|
2088
|
+
ChannelCalculated,
|
|
2089
|
+
ChannelLimits,
|
|
2090
|
+
DepositSourceTriggerCondition,
|
|
2091
|
+
FiatPaymentMethodCategory,
|
|
2092
|
+
FiatPaymentMethodDisplayType,
|
|
2093
|
+
FormNextStep,
|
|
2094
|
+
IssuerDetails,
|
|
2095
|
+
NoahBusinessFee,
|
|
2096
|
+
NoahComparisonOperator,
|
|
2097
|
+
NoahFeeDetails,
|
|
2098
|
+
NoahGetPaymentMethodsRequest,
|
|
2011
2099
|
NoahGetPaymentMethodsResponse,
|
|
2012
2100
|
NoahGetPaymentMethodsResponseData,
|
|
2013
2101
|
NoahGetPayoutChannelFormResponse,
|
|
@@ -2029,12 +2117,72 @@ export type {
|
|
|
2029
2117
|
NoahInitiatePayoutRequest,
|
|
2030
2118
|
NoahInitiatePayoutResponse,
|
|
2031
2119
|
NoahInitiatePayoutResponseData,
|
|
2120
|
+
NoahOnchainDepositSourceTriggerInput,
|
|
2121
|
+
NoahOnchainDepositSourceTriggerType,
|
|
2122
|
+
NoahPaymentMethodType,
|
|
2123
|
+
NoahPermanentOnchainDepositSourceTriggerInput,
|
|
2124
|
+
NoahProcessingTier,
|
|
2125
|
+
NoahQuotedOnchainDepositSourceTriggerInput,
|
|
2126
|
+
NoahSellQuote,
|
|
2032
2127
|
NoahSingleOnchainDepositSourceTriggerInput,
|
|
2033
2128
|
NoahSimulatePayinRequest,
|
|
2034
2129
|
NoahSimulatePayinResponse,
|
|
2035
2130
|
NoahSimulatePayinResponseData,
|
|
2036
2131
|
NoahSolanaCaipId,
|
|
2132
|
+
PaymentMethod,
|
|
2133
|
+
PaymentMethodDetails,
|
|
2037
2134
|
PortalApiSuccessEnvelope,
|
|
2135
|
+
NoahBankAddress,
|
|
2136
|
+
TransactionBreakdownItem,
|
|
2137
|
+
TransactionBreakdownType,
|
|
2138
|
+
} from './shared/types'
|
|
2139
|
+
|
|
2140
|
+
export type {
|
|
2141
|
+
MeldCreateCustomerRequest,
|
|
2142
|
+
MeldCreateCustomerResponse,
|
|
2143
|
+
MeldCreateRetailWidgetRequest,
|
|
2144
|
+
MeldCreateRetailWidgetResponse,
|
|
2145
|
+
MeldCreateRetailWidgetResponseData,
|
|
2146
|
+
MeldCountry,
|
|
2147
|
+
MeldCountryDefault,
|
|
2148
|
+
MeldCryptoCurrency,
|
|
2149
|
+
MeldCryptoCurrencySellLimit,
|
|
2150
|
+
MeldCustomer,
|
|
2151
|
+
MeldCustomerAddress,
|
|
2152
|
+
MeldCustomerAddressDetails,
|
|
2153
|
+
MeldCustomerName,
|
|
2154
|
+
MeldSearchCustomerResponse,
|
|
2155
|
+
MeldSearchCustomerResponseData,
|
|
2156
|
+
MeldCustomerType,
|
|
2157
|
+
MeldDiscoveryParams,
|
|
2158
|
+
MeldFiatCurrency,
|
|
2159
|
+
MeldFiatCurrencyPurchaseLimit,
|
|
2160
|
+
MeldGetBuyLimitsResponse,
|
|
2161
|
+
MeldGetCountriesResponse,
|
|
2162
|
+
MeldGetCryptoCurrenciesResponse,
|
|
2163
|
+
MeldGetDefaultsResponse,
|
|
2164
|
+
MeldGetFiatCurrenciesResponse,
|
|
2165
|
+
MeldGetKycLimitsResponse,
|
|
2166
|
+
MeldGetPaymentMethodsResponse,
|
|
2167
|
+
MeldGetRetailQuoteRequest,
|
|
2168
|
+
MeldGetRetailQuoteResponse,
|
|
2169
|
+
MeldGetRetailQuoteResponseData,
|
|
2170
|
+
MeldGetRetailTransactionResponse,
|
|
2171
|
+
MeldGetRetailTransactionResponseData,
|
|
2172
|
+
MeldGetSellLimitsResponse,
|
|
2173
|
+
MeldGetServiceProvidersResponse,
|
|
2174
|
+
MeldKycFiatLevel,
|
|
2175
|
+
MeldKycLimitTier,
|
|
2176
|
+
MeldPaymentMethod,
|
|
2177
|
+
MeldQuote,
|
|
2178
|
+
MeldRampIntelligence,
|
|
2179
|
+
MeldSearchRetailTransactionsParams,
|
|
2180
|
+
MeldSearchRetailTransactionsResponse,
|
|
2181
|
+
MeldSearchRetailTransactionsResponseData,
|
|
2182
|
+
MeldServiceProvider,
|
|
2183
|
+
MeldSessionData,
|
|
2184
|
+
MeldSessionType,
|
|
2185
|
+
MeldTransaction,
|
|
2038
2186
|
} from './shared/types'
|
|
2039
2187
|
|
|
2040
2188
|
export type {
|
|
@@ -2049,6 +2197,9 @@ export { MpcError, MpcErrorCodes } from './mpc'
|
|
|
2049
2197
|
|
|
2050
2198
|
export { PortalMpcError } from './mpc/errors'
|
|
2051
2199
|
|
|
2200
|
+
export { buildDefaultRpcConfig, DEFAULT_RPC_HOST } from './shared/rpc/defaults'
|
|
2201
|
+
export type { RpcConfig } from './shared/types'
|
|
2202
|
+
|
|
2052
2203
|
export {
|
|
2053
2204
|
type Address,
|
|
2054
2205
|
type Dapp,
|
|
@@ -2057,6 +2208,7 @@ export {
|
|
|
2057
2208
|
type LogLevel,
|
|
2058
2209
|
type MpcStatus,
|
|
2059
2210
|
type PortalOptions,
|
|
2211
|
+
type WalletNotOnDevicePayload,
|
|
2060
2212
|
} from '../types'
|
|
2061
2213
|
export { RequestMethod } from './provider'
|
|
2062
2214
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import Mpc from '../../mpc'
|
|
2
|
+
import Meld from './meld'
|
|
2
3
|
import Noah from './noah'
|
|
3
4
|
|
|
4
5
|
export default class Ramps {
|
|
6
|
+
public meld: Meld
|
|
5
7
|
public noah: Noah
|
|
6
8
|
|
|
7
9
|
constructor({ mpc }: { mpc: Mpc }) {
|
|
10
|
+
this.meld = new Meld({ mpc })
|
|
8
11
|
this.noah = new Noah({ mpc })
|
|
9
12
|
}
|
|
10
13
|
}
|