From 50c7b2c8226db0d2544ec064b99111ef5497fdfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Tue, 29 Oct 2024 14:41:24 +0100 Subject: [PATCH 1/4] Add support for swapping USDT --- .gitignore | 2 + client/.gitignore | 2 - client/PublicRequestTypes.ts | 20 +++++-- client/package.json | 2 +- client/yarn.lock | 8 +-- package.json | 4 +- src/lib/RequestParser.ts | 98 ++++++++++++++++++++-------------- src/lib/RequestTypes.ts | 10 ++-- src/views/SetupSwap.vue | 9 ++-- src/views/SetupSwapSuccess.vue | 69 ++++++++++++++++-------- yarn.lock | 29 +++------- 11 files changed, 147 insertions(+), 106 deletions(-) delete mode 100644 client/.gitignore diff --git a/.gitignore b/.gitignore index 71fbe9530..aceec40ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .DS_Store node_modules dist +client/dist +client/build # only yarn package-lock.json diff --git a/client/.gitignore b/client/.gitignore deleted file mode 100644 index 9d0b71a3c..000000000 --- a/client/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build -dist diff --git a/client/PublicRequestTypes.ts b/client/PublicRequestTypes.ts index 8e885f7f9..0227753ec 100644 --- a/client/PublicRequestTypes.ts +++ b/client/PublicRequestTypes.ts @@ -271,7 +271,7 @@ export interface BitcoinHtlcCreationInstructions { } export interface PolygonHtlcCreationInstructions extends RelayRequest { - type: 'USDC_MATIC'; + type: 'USDC_MATIC' | 'USDT_MATIC'; /** * The sender's nonce in the token contract, required when calling the * contract function `openWithPermit`. @@ -279,6 +279,14 @@ export interface PolygonHtlcCreationInstructions extends RelayRequest { permit?: { tokenNonce: number, }; + + /** + * The sender's nonce in the token contract, required when calling the + * contract function `openWithApproval`. + */ + approval?: { + tokenNonce: number, + }; } export interface EuroHtlcCreationInstructions { @@ -312,7 +320,7 @@ export interface BitcoinHtlcSettlementInstructions { } export interface PolygonHtlcSettlementInstructions extends RelayRequest { - type: 'USDC_MATIC'; + type: 'USDC_MATIC' | 'USDT_MATIC'; amount: number; } @@ -360,7 +368,7 @@ export interface BitcoinHtlcRefundInstructions { } export interface PolygonHtlcRefundInstructions extends RelayRequest { - type: 'USDC_MATIC' | 'USDC'; + type: 'USDC_MATIC' | 'USDC' | 'USDT_MATIC'; amount: number; } @@ -411,6 +419,7 @@ export interface SetupSwapRequest extends SimpleRequest { polygonAddresses?: Array<{ address: string, usdcBalance: number, // In USDC's smallest unit + usdtBalance: number, // In USDT's smallest unit }>; // Optional KYC info for swapping at higher limits @@ -427,6 +436,7 @@ export interface SetupSwapResult { nimProxy?: SignedTransaction; btc?: SignedBtcTransaction; usdc?: SignedPolygonTransaction; + usdt?: SignedPolygonTransaction; eur?: string; // When funding EUR: empty string, when redeeming EUR: JWS of the settlement instructions refundTx?: string; } @@ -612,7 +622,7 @@ export interface SignPolygonTransactionRequest extends BasicRequest, RelayReques recipientLabel?: string; /** * The sender's nonce in the token contract, required when calling the - * contract function `swapWithApproval` for bridged USDC.e. + * contract function `swapWithApproval` for bridged USDC.e and `transferWithApproval` for bridged USDT. */ approval?: { tokenNonce: number, @@ -626,7 +636,7 @@ export interface SignPolygonTransactionRequest extends BasicRequest, RelayReques }; /** - * The amount of USDC to transfer. Required when calling the contract + * The amount of USDC/T to transfer. Required when calling the contract * methods 'redeem' and 'redeemWithSecretInData' for HTLCs. */ amount?: number; diff --git a/client/package.json b/client/package.json index c200843d6..b6dabba70 100644 --- a/client/package.json +++ b/client/package.json @@ -10,7 +10,7 @@ "types": "types/index.d.ts", "dependencies": { "@nimiq/core-web": "^1.6.1", - "@nimiq/fastspot-api": "^1.8.0", + "@nimiq/fastspot-api": "^1.10.2", "@nimiq/rpc": "^0.4.0", "@nimiq/utils": "^0.5.0", "@opengsn/common": "^2.2.5", diff --git a/client/yarn.lock b/client/yarn.lock index 7dc40e2c8..3d38e2048 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -232,10 +232,10 @@ resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.6.1.tgz#97cb5b43b257c7f6f6808ef603e9bf686377241f" integrity sha512-WYw2brIxUXa/SQ0JRp0RXWQKzBFhROXrEjF9Eh+tRlC+NrI2ObwRQkwJCbP2qmPtYldIimfyECmsDVHFoyLXjQ== -"@nimiq/fastspot-api@^1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@nimiq/fastspot-api/-/fastspot-api-1.8.0.tgz#705a9e79e425c3e6536d8994fd0b39d88af1b268" - integrity sha512-qNkibJnxS8ndOn4tuy1m3lSNKybBYApo+wy1ajTKcQ0lHo3VfLY0sAJ+WRE7diVWCa7iumu6wsFVudyc3k8/NQ== +"@nimiq/fastspot-api@^1.10.2": + version "1.10.2" + resolved "https://registry.yarnpkg.com/@nimiq/fastspot-api/-/fastspot-api-1.10.2.tgz#ae2cbe5b41359875bece9ce0957209ca1b486d21" + integrity sha512-rPy3DhWlqTOj4k9/YMS2mizjR1rLsQzqWzMnJ+xDEGprgb6/jhDBZs/CW+jONccRQWrvuyBYTrrxdLgn3imKjQ== "@nimiq/rpc@^0.4.0": version "0.4.0" diff --git a/package.json b/package.json index 8df82e867..f028a88af 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "dependencies": { "@nimiq/browser-warning": "^1.1.1", "@nimiq/electrum-client": "https://github.com/nimiq/electrum-client#build", - "@nimiq/fastspot-api": "^1.8.0", + "@nimiq/fastspot-api": "^1.10.2", "@nimiq/iqons": "^1.5.2", - "@nimiq/keyguard-client": "^1.6.0", + "@nimiq/keyguard-client": "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&38dfefaef131cfe12524ff3aba28e37a0fe09c33", "@nimiq/ledger-api": "^3.0.0", "@nimiq/network-client": "^0.6.2", "@nimiq/oasis-api": "^1.1.1", diff --git a/src/lib/RequestParser.ts b/src/lib/RequestParser.ts index c5ea05777..b067f18dc 100644 --- a/src/lib/RequestParser.ts +++ b/src/lib/RequestParser.ts @@ -527,11 +527,11 @@ export class RequestParser { // Validate and parse only what we use in the Hub - if (!['NIM', 'BTC', 'USDC_MATIC', 'EUR'].includes(setupSwapRequest.fund.type)) { + if (!['NIM', 'BTC', 'USDC_MATIC', 'USDT_MATIC', 'EUR'].includes(setupSwapRequest.fund.type)) { throw new Error('Funding type is not supported'); } - if (!['NIM', 'BTC', 'USDC_MATIC', 'EUR'].includes(setupSwapRequest.redeem.type)) { + if (!['NIM', 'BTC', 'USDC_MATIC', 'USDT_MATIC', 'EUR'].includes(setupSwapRequest.redeem.type)) { throw new Error('Redeeming type is not supported'); } @@ -539,6 +539,13 @@ export class RequestParser { throw new Error('Cannot swap between the same types'); } + if ( + (setupSwapRequest.fund.type === 'USDC_MATIC' && setupSwapRequest.redeem.type === 'USDT_MATIC') + || (setupSwapRequest.fund.type === 'USDT_MATIC' && setupSwapRequest.redeem.type === 'USDC_MATIC') + ) { + throw new Error('Cannot swap between USDC and USDT'); + } + if (setupSwapRequest.layout === 'slider') { if ( typeof setupSwapRequest.direction !== 'string' @@ -573,13 +580,15 @@ export class RequestParser { } const polygonAddress = setupSwapRequest.fund.type === SwapAsset.USDC_MATIC + || setupSwapRequest.fund.type === SwapAsset.USDT_MATIC ? setupSwapRequest.fund.request.from : setupSwapRequest.redeem.type === SwapAsset.USDC_MATIC + || setupSwapRequest.redeem.type === SwapAsset.USDT_MATIC ? setupSwapRequest.redeem.request.from : undefined; if (polygonAddress && !setupSwapRequest.polygonAddresses.some( ({ address }) => address === polygonAddress)) { - throw new Error('The address details of the USDC address doing the swap must be provided'); + throw new Error('The address details of the Polgyon address doing the swap must be provided'); } } @@ -616,44 +625,53 @@ export class RequestParser { } } + const fund: ParsedSetupSwapRequest['fund'] | null = setupSwapRequest.fund.type === 'NIM' ? { + ...setupSwapRequest.fund, + type: SwapAsset[setupSwapRequest.fund.type], + sender: Nimiq.Address.fromAny(setupSwapRequest.fund.sender), + } : setupSwapRequest.fund.type === 'BTC' ? { + ...setupSwapRequest.fund, + type: SwapAsset[setupSwapRequest.fund.type], + } : setupSwapRequest.fund.type === 'USDC_MATIC' || setupSwapRequest.fund.type === 'USDT_MATIC' ? { + ...setupSwapRequest.fund, + type: SwapAsset[setupSwapRequest.fund.type], + } : setupSwapRequest.fund.type === 'EUR' ? { + ...setupSwapRequest.fund, + type: SwapAsset[setupSwapRequest.fund.type], + } : null; + + if (!fund) { + throw new Error('Unsupported funding object type'); + } + + const redeem: ParsedSetupSwapRequest['redeem'] | null = setupSwapRequest.redeem.type === 'NIM' ? { + ...setupSwapRequest.redeem, + type: SwapAsset[setupSwapRequest.redeem.type], + recipient: Nimiq.Address.fromAny(setupSwapRequest.redeem.recipient), + extraData: typeof setupSwapRequest.redeem.extraData === 'string' + ? Nimiq.BufferUtils.fromAny(setupSwapRequest.redeem.extraData) + : setupSwapRequest.redeem.extraData, + } : setupSwapRequest.redeem.type === 'BTC' ? { + ...setupSwapRequest.redeem, + type: SwapAsset[setupSwapRequest.redeem.type], + } : setupSwapRequest.redeem.type === 'USDC_MATIC' || setupSwapRequest.redeem.type === 'USDT_MATIC' ? { + ...setupSwapRequest.redeem, + type: SwapAsset[setupSwapRequest.redeem.type], + } : setupSwapRequest.redeem.type === 'EUR' ? { + ...setupSwapRequest.redeem, + type: SwapAsset[setupSwapRequest.redeem.type], + } : null; + + if (!redeem) { + throw new Error('Unsupported redeeming object type'); + } + const parsedSetupSwapRequest: ParsedSetupSwapRequest = { kind: RequestType.SETUP_SWAP, walletId: setupSwapRequest.accountId, ...setupSwapRequest, - - fund: setupSwapRequest.fund.type === 'NIM' ? { - ...setupSwapRequest.fund, - type: SwapAsset[setupSwapRequest.fund.type], - sender: Nimiq.Address.fromAny(setupSwapRequest.fund.sender), - } : setupSwapRequest.fund.type === 'BTC' ? { - ...setupSwapRequest.fund, - type: SwapAsset[setupSwapRequest.fund.type], - } : setupSwapRequest.fund.type === 'USDC_MATIC' ? { - ...setupSwapRequest.fund, - type: SwapAsset[setupSwapRequest.fund.type], - } : { // EUR - ...setupSwapRequest.fund, - type: SwapAsset[setupSwapRequest.fund.type], - }, - - redeem: setupSwapRequest.redeem.type === 'NIM' ? { - ...setupSwapRequest.redeem, - type: SwapAsset[setupSwapRequest.redeem.type], - recipient: Nimiq.Address.fromAny(setupSwapRequest.redeem.recipient), - extraData: typeof setupSwapRequest.redeem.extraData === 'string' - ? Nimiq.BufferUtils.fromAny(setupSwapRequest.redeem.extraData) - : setupSwapRequest.redeem.extraData, - } : setupSwapRequest.redeem.type === 'BTC' ? { - ...setupSwapRequest.redeem, - type: SwapAsset[setupSwapRequest.redeem.type], - } : setupSwapRequest.redeem.type === 'USDC_MATIC' ? { - ...setupSwapRequest.redeem, - type: SwapAsset[setupSwapRequest.redeem.type], - } : { // EUR - ...setupSwapRequest.redeem, - type: SwapAsset[setupSwapRequest.redeem.type], - }, - + fund, + redeem, layout: setupSwapRequest.layout || 'standard', }; @@ -664,8 +682,8 @@ export class RequestParser { // Only basic parsing and validation. Refund transaction specific data will be validated by the Keyguard // or subsequent Ledger transaction signing requests. - if (!['NIM', 'BTC', 'USDC', 'USDC_MATIC'].includes(refundSwapRequest.refund.type)) { - throw new Error('Refunding object type must be "NIM", "BTC", "USDC", or "USDC_MATIC"'); + if (!['NIM', 'BTC', 'USDC', 'USDC_MATIC', 'USDT_MATIC'].includes(refundSwapRequest.refund.type)) { + throw new Error('Refunding object type must be "NIM", "BTC", "USDC", "USDC_MATIC" or "USDT_MATIC"'); } const parsedRefundSwapRequest: ParsedRefundSwapRequest = { @@ -684,7 +702,7 @@ export class RequestParser { } : refundSwapRequest.refund.type === 'BTC' ? { ...refundSwapRequest.refund, type: SwapAsset[refundSwapRequest.refund.type], - } : { // USDC + } : { // USDC/T ...refundSwapRequest.refund, type: SwapAsset[refundSwapRequest.refund.type], }, diff --git a/src/lib/RequestTypes.ts b/src/lib/RequestTypes.ts index 99b6124d5..48d1b8570 100644 --- a/src/lib/RequestTypes.ts +++ b/src/lib/RequestTypes.ts @@ -200,10 +200,13 @@ export interface ParsedSetupSwapRequest extends ParsedSimpleRequest { // htlcScript: Uint8Array, refundAddress: string, } | ({ - type: SwapAsset.USDC_MATIC, + type: SwapAsset.USDC_MATIC | SwapAsset.USDT_MATIC, permit?: { tokenNonce: number, }, + approval?: { + tokenNonce: number, + }, } & RelayRequest) | { type: SwapAsset.EUR, value: number, // Eurocents @@ -234,7 +237,7 @@ export interface ParsedSetupSwapRequest extends ParsedSimpleRequest { value: number, // Sats }; } | ({ - type: SwapAsset.USDC_MATIC, + type: SwapAsset.USDC_MATIC | SwapAsset.USDT_MATIC, amount: number, } & RelayRequest) | { type: SwapAsset.EUR, @@ -278,6 +281,7 @@ export interface ParsedSetupSwapRequest extends ParsedSimpleRequest { polygonAddresses?: Array<{ address: string, usdcBalance: number, // In USDC's smallest unit + usdtBalance: number, // In USDT's smallest unit }>; // Optional KYC info for swapping at higher limits @@ -313,7 +317,7 @@ export interface ParsedRefundSwapRequest extends ParsedSimpleRequest { }; refundAddress: string; // My address, must be refund address of HTLC } | ({ - type: SwapAsset.USDC_MATIC | SwapAsset.USDC, + type: SwapAsset.USDC_MATIC | SwapAsset.USDC | SwapAsset.USDT_MATIC, amount: number, } & RelayRequest); } diff --git a/src/views/SetupSwap.vue b/src/views/SetupSwap.vue index ba698a402..69117a8ac 100644 --- a/src/views/SetupSwap.vue +++ b/src/views/SetupSwap.vue @@ -182,7 +182,7 @@ export default class SetupSwap extends BitcoinSyncBaseView { }; } - if (this.request.fund.type === SwapAsset.USDC_MATIC) { + if (this.request.fund.type === SwapAsset.USDC_MATIC || this.request.fund.type === SwapAsset.USDT_MATIC) { const senderAddress = this.request.fund.request.from; const signer = this._account.polygonAddresses.find((ai) => ai.address === senderAddress); @@ -191,11 +191,12 @@ export default class SetupSwap extends BitcoinSyncBaseView { } fundingInfo = { - type: SwapAsset.USDC_MATIC, + type: this.request.fund.type, keyPath: signer.path, request: this.request.fund.request, relayData: this.request.fund.relayData, permit: this.request.fund.permit, + approval: this.request.fund.approval, }; } @@ -254,7 +255,7 @@ export default class SetupSwap extends BitcoinSyncBaseView { }; } - if (this.request.redeem.type === SwapAsset.USDC_MATIC) { + if (this.request.redeem.type === SwapAsset.USDC_MATIC || this.request.redeem.type === SwapAsset.USDT_MATIC) { const senderAddress = this.request.redeem.request.from; const signer = this._account.polygonAddresses.find((ai) => ai.address === senderAddress); @@ -263,7 +264,7 @@ export default class SetupSwap extends BitcoinSyncBaseView { } redeemingInfo = { - type: SwapAsset.USDC_MATIC, + type: this.request.redeem.type, keyPath: signer.path, request: this.request.redeem.request, relayData: this.request.redeem.relayData, diff --git a/src/views/SetupSwapSuccess.vue b/src/views/SetupSwapSuccess.vue index a75b0b1ac..8348d3059 100644 --- a/src/views/SetupSwapSuccess.vue +++ b/src/views/SetupSwapSuccess.vue @@ -14,7 +14,7 @@ import { NimHtlcDetails, BtcHtlcDetails, Contract, -UsdcHtlcDetails, + Erc20HtlcDetails, } from '@nimiq/fastspot-api'; import { init as initOasisApi, exchangeAuthorizationToken } from '@nimiq/oasis-api'; import StatusScreen from '../components/StatusScreen.vue'; @@ -85,6 +85,7 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { refundAddress = this.request.fund.refundAddress; break; case SwapAsset.USDC_MATIC: + case SwapAsset.USDT_MATIC: refundAddress = this.request.fund.request.from; break; default: break; @@ -99,6 +100,7 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { redeemAddress = this.request.redeem.output.address; break; case SwapAsset.USDC_MATIC: + case SwapAsset.USDT_MATIC: redeemAddress = this.request.redeem.request.from; break; case SwapAsset.EUR: @@ -228,9 +230,16 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { } } - if (confirmedSwap.from.asset === SwapAsset.USDC_MATIC || confirmedSwap.to.asset === SwapAsset.USDC_MATIC) { - const contract = confirmedSwap.contracts[SwapAsset.USDC_MATIC] as Contract; - const htlc = contract.htlc as UsdcHtlcDetails; + if ( + confirmedSwap.from.asset === SwapAsset.USDC_MATIC + || confirmedSwap.to.asset === SwapAsset.USDC_MATIC + || confirmedSwap.from.asset === SwapAsset.USDT_MATIC + || confirmedSwap.to.asset === SwapAsset.USDT_MATIC + ) { + const contract = + (confirmedSwap.contracts[SwapAsset.USDC_MATIC] as Contract | undefined) + || (confirmedSwap.contracts[SwapAsset.USDT_MATIC] as Contract); + const htlc = contract.htlc as Erc20HtlcDetails; const contractData = { id: contract.htlc.address, @@ -254,11 +263,17 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { } hashRoot = contractData.hash; - if (confirmedSwap.from.asset === SwapAsset.USDC_MATIC && refundAddress !== contractData.refundAddress) { + if ( + [SwapAsset.USDC_MATIC, SwapAsset.USDT_MATIC].includes(confirmedSwap.from.asset) + && refundAddress !== contractData.refundAddress + ) { this.$rpc.reject(new Error('Unknown HTLC refund address')); return; } - if (confirmedSwap.to.asset === SwapAsset.USDC_MATIC && redeemAddress !== contractData.recipientAddress) { + if ( + [SwapAsset.USDC_MATIC, SwapAsset.USDT_MATIC].includes(confirmedSwap.to.asset) + && redeemAddress !== contractData.recipientAddress + ) { this.$rpc.reject(new Error('Unknown HTLC redeem address')); return; } @@ -304,17 +319,17 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { }; } - if (this.request.fund.type === SwapAsset.USDC_MATIC) { - const usdcHtlcData = confirmedSwap.contracts[SwapAsset.USDC_MATIC]!.htlc as UsdcHtlcDetails; + if (this.request.fund.type === SwapAsset.USDC_MATIC || this.request.fund.type === SwapAsset.USDT_MATIC) { + const htlcData = confirmedSwap.contracts[this.request.fund.type]!.htlc as Erc20HtlcDetails; - if (!usdcHtlcData.data) { + if (!htlcData.data) { // TODO: Create data with ethersJS - throw new Error('Missing `data` field in confirmed USDC contract'); + throw new Error('Missing `data` field in confirmed ERC-20 contract'); } fundingHtlcInfo = { - type: SwapAsset.USDC_MATIC, - htlcData: usdcHtlcData.data, + type: this.request.fund.type, + htlcData: htlcData.data, }; } @@ -409,15 +424,17 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { } } - if (this.request.redeem.type === SwapAsset.USDC_MATIC) { - const usdcContract = confirmedSwap.contracts[SwapAsset.USDC_MATIC] as Contract; - const usdcHtlcData = usdcContract.htlc as UsdcHtlcDetails; + if (this.request.redeem.type === SwapAsset.USDC_MATIC || this.request.redeem.type === SwapAsset.USDT_MATIC) { + const contract = confirmedSwap.contracts[this.request.redeem.type] as Contract< + SwapAsset.USDC_MATIC | SwapAsset.USDT_MATIC + >; + const htlcData = contract.htlc as Erc20HtlcDetails; redeemingHtlcInfo = { - type: SwapAsset.USDC_MATIC, + type: this.request.redeem.type, hash: confirmedSwap.hash, - timeout: usdcContract.timeout, - htlcId: usdcHtlcData.address, + timeout: contract.timeout, + htlcId: htlcData.address, }; } @@ -445,7 +462,8 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { let nimiqTransaction: Nimiq.Transaction | undefined; let nimiqProxyTransaction: Nimiq.Transaction | undefined; let bitcoinTransaction: SignedBtcTransaction | undefined; - let polygonTransaction: SignedPolygonTransaction | undefined; + let polygonUsdcTransaction: SignedPolygonTransaction | undefined; + let polygonUsdtTransaction: SignedPolygonTransaction | undefined; let refundTransaction: string | undefined; let euroSettlement: string | undefined; try { @@ -459,7 +477,8 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { nimProxy: nimiqProxyTransaction, btc: bitcoinTransaction, eur: euroSettlement, - usdc: polygonTransaction, + usdc: polygonUsdcTransaction, + usdt: polygonUsdtTransaction, refundTx: refundTransaction, } = signingResult); } catch (error) { @@ -503,7 +522,8 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { ? await this.nimiqNetwork.makeSignTransactionResult(nimiqProxyTransaction) : undefined, btc: bitcoinTransaction, - usdc: polygonTransaction, + usdc: polygonUsdcTransaction, + usdt: polygonUsdtTransaction, eur: euroSettlement, refundTx: refundTransaction, }; @@ -534,6 +554,7 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { nimProxy?: Nimiq.Transaction, // only in SetupSwapLedger btc?: SignedBtcTransaction, usdc?: SignedPolygonTransaction, + usdt?: SignedPolygonTransaction, eur?: string, refundTx?: string, } | null> { @@ -548,7 +569,8 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { const { nim: nimiqSignatureResult, btc: bitcoinTransaction, - usdc: polygonTransaction, + usdc: polygonUsdcTransaction, + usdt: polygonUsdtTransaction, eur: euroSettlement, refundTx, } = await client.signSwapTransactions(keyguardRequest); @@ -582,7 +604,8 @@ export default class SetupSwapSuccess extends BitcoinSyncBaseView { serializedTx: bitcoinTransaction.raw, hash: bitcoinTransaction.transactionHash, } : undefined, - usdc: polygonTransaction, + ...(polygonUsdcTransaction ? { usdc: polygonUsdcTransaction } : {}), + ...(polygonUsdtTransaction ? { usdt: polygonUsdtTransaction } : {}), eur: euroSettlement, refundTx, }; diff --git a/yarn.lock b/yarn.lock index aa887df0e..7df4f6e2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1987,11 +1987,6 @@ resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.5.3.tgz#f0a4de59394f210f2c2d9cda8ee35c716847d40e" integrity sha512-W66SS9n3ygYgD52r1GJr1WtYYOkcZsqdtMmDCEwDvkrmeARnHs2sAvj77Wt4PQG8JA7GwK5svIJr6rGccCaekw== -"@nimiq/core-web@1.5.8": - version "1.5.8" - resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.5.8.tgz#da8abef84c6d293cbb9ca495a77f08daa08886b9" - integrity sha512-MNpFbGZetz2eZcHtJVa5tpmLjPf65mTcJBRQkOHS8kWE+f+Z++hdnwWUBQCEAph4oC6bsE5JSuU7VpwcogN7+w== - "@nimiq/core-web@^1.6.1": version "1.6.1" resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.6.1.tgz#97cb5b43b257c7f6f6808ef603e9bf686377241f" @@ -2026,10 +2021,10 @@ dependencies: bitcoinjs-lib "^5.1.10" -"@nimiq/fastspot-api@^1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@nimiq/fastspot-api/-/fastspot-api-1.8.0.tgz#705a9e79e425c3e6536d8994fd0b39d88af1b268" - integrity sha512-qNkibJnxS8ndOn4tuy1m3lSNKybBYApo+wy1ajTKcQ0lHo3VfLY0sAJ+WRE7diVWCa7iumu6wsFVudyc3k8/NQ== +"@nimiq/fastspot-api@^1.10.2": + version "1.10.2" + resolved "https://registry.yarnpkg.com/@nimiq/fastspot-api/-/fastspot-api-1.10.2.tgz#ae2cbe5b41359875bece9ce0957209ca1b486d21" + integrity sha512-rPy3DhWlqTOj4k9/YMS2mizjR1rLsQzqWzMnJ+xDEGprgb6/jhDBZs/CW+jONccRQWrvuyBYTrrxdLgn3imKjQ== "@nimiq/iqons@^1.5.2", "@nimiq/iqons@^1.6.0": version "1.6.0" @@ -2047,14 +2042,9 @@ btoa "^1.1.2" node-lmdb "^0.9.6" -"@nimiq/keyguard-client@^1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@nimiq/keyguard-client/-/keyguard-client-1.6.0.tgz#e2cb22c1af5ae68dac74e5ead9e69aeaba2ffc8b" - integrity sha512-DDi+PycBtiTJO5Jwk3mHZzBP2FHARNCIR+9C6+uhw6kRlT/pcDS+vE6GeTGOwZsRGOtowLG3d9n43xWoPOOcGQ== - dependencies: - "@nimiq/core-web" "1.5.8" - "@nimiq/rpc" "^0.3.0" - "@opengsn/common" "^2.2.5" +"@nimiq/keyguard-client@https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&38dfefaef131cfe12524ff3aba28e37a0fe09c33": + version "1.0.0" + resolved "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&38dfefaef131cfe12524ff3aba28e37a0fe09c33#02dcb5a0db0ad4f970ef041f7e9f442a496999cc" "@nimiq/ledger-api@^3.0.0": version "3.0.0" @@ -2102,11 +2092,6 @@ resolved "https://registry.yarnpkg.com/@nimiq/rpc/-/rpc-0.1.5.tgz#53919b0a3a9abcdfebee0e865f4c663f72a8b8c2" integrity sha512-oTRThXzpbQOY8jz8h+2KXucWzW40nVfYBWROKXKBrSozhTG0nR+rzCbEm4ZyTC26b4RnmB6y4nYabUXi7gNWcA== -"@nimiq/rpc@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@nimiq/rpc/-/rpc-0.3.0.tgz#654c05acccc193b7d79fb09b2faf2114945ff872" - integrity sha512-je7fv+wP4nLEgTcZwu3FaGre22qkZ9AYGbStglVaJAxOH+3CvDnnOIa9IjGFaCEhtRQKRaQEvFqa5vN4IVnH+Q== - "@nimiq/rpc@^0.4.1": version "0.4.1" resolved "https://registry.yarnpkg.com/@nimiq/rpc/-/rpc-0.4.1.tgz#d5df1e426793afcdd8c407a2968442bbee874dbd" From a8533557f86d1bd876d2a9b98187f3aa79df7fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Tue, 5 Nov 2024 13:15:17 +0100 Subject: [PATCH 2/4] Update Keyguard client and forward `token` for Polygon transaction signing requests --- client/PublicRequestTypes.ts | 4 ++++ package.json | 2 +- yarn.lock | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/PublicRequestTypes.ts b/client/PublicRequestTypes.ts index 0227753ec..f1c4cd9fa 100644 --- a/client/PublicRequestTypes.ts +++ b/client/PublicRequestTypes.ts @@ -645,6 +645,10 @@ export interface SignPolygonTransactionRequest extends BasicRequest, RelayReques * methods 'redeem' and 'redeemWithSecretInData' for HTLCs. */ senderLabel?: string; + /** + * The token contract address. Required for calling the bridged HTLC contract. + */ + token?: string, } export interface SignedPolygonTransaction { diff --git a/package.json b/package.json index f028a88af..da0cec3d1 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@nimiq/electrum-client": "https://github.com/nimiq/electrum-client#build", "@nimiq/fastspot-api": "^1.10.2", "@nimiq/iqons": "^1.5.2", - "@nimiq/keyguard-client": "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&38dfefaef131cfe12524ff3aba28e37a0fe09c33", + "@nimiq/keyguard-client": "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&3be7f01c13d981d79296dc225b46a4fcb42c3a6c", "@nimiq/ledger-api": "^3.0.0", "@nimiq/network-client": "^0.6.2", "@nimiq/oasis-api": "^1.1.1", diff --git a/yarn.lock b/yarn.lock index 7df4f6e2c..eb28d6817 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2042,9 +2042,9 @@ btoa "^1.1.2" node-lmdb "^0.9.6" -"@nimiq/keyguard-client@https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&38dfefaef131cfe12524ff3aba28e37a0fe09c33": +"@nimiq/keyguard-client@https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&3be7f01c13d981d79296dc225b46a4fcb42c3a6c": version "1.0.0" - resolved "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&38dfefaef131cfe12524ff3aba28e37a0fe09c33#02dcb5a0db0ad4f970ef041f7e9f442a496999cc" + resolved "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&3be7f01c13d981d79296dc225b46a4fcb42c3a6c#dd4feb2f56672b02f4c994398d2525758c4a7109" "@nimiq/ledger-api@^3.0.0": version "3.0.0" From dcbe9fdc775451d96f742d6ebf4d501d1ff68645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Tue, 5 Nov 2024 16:24:32 +0100 Subject: [PATCH 3/4] Accept and forward `token` address in swap refund requests --- client/PublicRequestTypes.ts | 6 +++++- src/lib/RequestTypes.ts | 2 ++ src/views/RefundSwap.vue | 13 +++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/client/PublicRequestTypes.ts b/client/PublicRequestTypes.ts index f1c4cd9fa..8eded25c9 100644 --- a/client/PublicRequestTypes.ts +++ b/client/PublicRequestTypes.ts @@ -370,6 +370,10 @@ export interface BitcoinHtlcRefundInstructions { export interface PolygonHtlcRefundInstructions extends RelayRequest { type: 'USDC_MATIC' | 'USDC' | 'USDT_MATIC'; amount: number; + /** + * The token contract address. Required for calling the bridged HTLC contract. + */ + token: string; } export type HtlcCreationInstructions = @@ -648,7 +652,7 @@ export interface SignPolygonTransactionRequest extends BasicRequest, RelayReques /** * The token contract address. Required for calling the bridged HTLC contract. */ - token?: string, + token?: string; } export interface SignedPolygonTransaction { diff --git a/src/lib/RequestTypes.ts b/src/lib/RequestTypes.ts index 48d1b8570..24b656693 100644 --- a/src/lib/RequestTypes.ts +++ b/src/lib/RequestTypes.ts @@ -162,6 +162,7 @@ export interface ParsedSignPolygonTransactionRequest extends ParsedBasicRequest, }; amount?: number; senderLabel?: string; + token?: string; } /** @@ -319,6 +320,7 @@ export interface ParsedRefundSwapRequest extends ParsedSimpleRequest { } | ({ type: SwapAsset.USDC_MATIC | SwapAsset.USDC | SwapAsset.USDT_MATIC, amount: number, + token: string, } & RelayRequest); } diff --git a/src/views/RefundSwap.vue b/src/views/RefundSwap.vue index b1db757aa..6347d36fb 100644 --- a/src/views/RefundSwap.vue +++ b/src/views/RefundSwap.vue @@ -20,7 +20,7 @@ import { SwapAsset } from '@nimiq/fastspot-api'; // (But note that currently, the KeyguardClient is still always bundled in the RpcApi). type KeyguardSignNimTransactionRequest = import('@nimiq/keyguard-client').SignTransactionRequestStandard; type KeyguardSignBtcTransactionRequest = import('@nimiq/keyguard-client').SignBtcTransactionRequestStandard; -type KeyguardSignUsdcTransactionRequest = import('@nimiq/keyguard-client').SignPolygonTransactionRequest; +type KeyguardSignPolygonTransactionRequest = import('@nimiq/keyguard-client').SignPolygonTransactionRequest; @Component({components: {StatusScreen, SmallPage, GlobalClose}}) // including components used in parent class export default class RefundSwap extends BitcoinSyncBaseView { @@ -122,7 +122,11 @@ export default class RefundSwap extends BitcoinSyncBaseView { this._signTransaction(signRequest); } - if (refundInfo.type === SwapAsset.USDC_MATIC || refundInfo.type === SwapAsset.USDC) { + if ( + refundInfo.type === SwapAsset.USDC_MATIC + || refundInfo.type === SwapAsset.USDC + || refundInfo.type === SwapAsset.USDT_MATIC + ) { const signer = account.polygonAddresses.find((ai) => ai.address === refundInfo.request.from); if (!signer) { @@ -130,7 +134,7 @@ export default class RefundSwap extends BitcoinSyncBaseView { return; } - const signRequest: KeyguardSignUsdcTransactionRequest = { + const signRequest: KeyguardSignPolygonTransactionRequest = { appName: request.appName, ...refundInfo, @@ -140,6 +144,7 @@ export default class RefundSwap extends BitcoinSyncBaseView { keyPath: signer.path, senderLabel: 'Swap HTLC', + token: refundInfo.token, }; this._signTransaction(signRequest); @@ -149,7 +154,7 @@ export default class RefundSwap extends BitcoinSyncBaseView { protected _signTransaction( request: KeyguardSignNimTransactionRequest | KeyguardSignBtcTransactionRequest - | KeyguardSignUsdcTransactionRequest, + | KeyguardSignPolygonTransactionRequest, ) { // Note that this method gets overwritten in RefundSwapLedger const client = this.$rpc.createKeyguardClient(true); From 25c9f71613045512889138b240724a8f1662432f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Tue, 5 Nov 2024 17:20:08 +0100 Subject: [PATCH 4/4] Update Keyguard client and @nimiq/core versions --- client/package.json | 4 +-- client/yarn.lock | 8 ++--- package.json | 6 ++-- yarn.lock | 71 +++++++++++++++++++++++++++------------------ 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/client/package.json b/client/package.json index b6dabba70..c62204d9b 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@nimiq/hub-api", - "version": "1.8.0", + "version": "1.9.0", "main": "dist/HubApi.umd.js", "module": "dist/HubApi.es.js", "repository": "https://github.com/nimiq/hub/tree/master/client", @@ -9,7 +9,7 @@ "private": false, "types": "types/index.d.ts", "dependencies": { - "@nimiq/core-web": "^1.6.1", + "@nimiq/core-web": "^1.6.3", "@nimiq/fastspot-api": "^1.10.2", "@nimiq/rpc": "^0.4.0", "@nimiq/utils": "^0.5.0", diff --git a/client/yarn.lock b/client/yarn.lock index 3d38e2048..e91c69385 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -227,10 +227,10 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@nimiq/core-web@^1.6.1": - version "1.6.1" - resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.6.1.tgz#97cb5b43b257c7f6f6808ef603e9bf686377241f" - integrity sha512-WYw2brIxUXa/SQ0JRp0RXWQKzBFhROXrEjF9Eh+tRlC+NrI2ObwRQkwJCbP2qmPtYldIimfyECmsDVHFoyLXjQ== +"@nimiq/core-web@^1.6.3": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.6.3.tgz#b4a8f8c5d289850b20cb4009766af5b1cafd6e20" + integrity sha512-D6RrJi2cRU81odNpmwczhUBvOQ47+/Db1svrTkH/G4xNd72lr9MS5nMdfpUz+rBRnSprljrzW2mdUtZ6W9bPaA== "@nimiq/fastspot-api@^1.10.2": version "1.10.2" diff --git a/package.json b/package.json index da0cec3d1..2717b4db9 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@nimiq/electrum-client": "https://github.com/nimiq/electrum-client#build", "@nimiq/fastspot-api": "^1.10.2", "@nimiq/iqons": "^1.5.2", - "@nimiq/keyguard-client": "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&3be7f01c13d981d79296dc225b46a4fcb42c3a6c", + "@nimiq/keyguard-client": "^1.7.1", "@nimiq/ledger-api": "^3.0.0", "@nimiq/network-client": "^0.6.2", "@nimiq/oasis-api": "^1.1.1", @@ -44,8 +44,8 @@ "vuex-class": "^0.3.2" }, "devDependencies": { - "@nimiq/core": "^1.6.1", - "@nimiq/core-web": "^1.6.1", + "@nimiq/core": "^1.6.3", + "@nimiq/core-web": "^1.6.3", "@vue/cli-plugin-babel": "~4.5.19", "@vue/cli-plugin-typescript": "~4.5.19", "@vue/cli-plugin-unit-jest": "~4.5.19", diff --git a/yarn.lock b/yarn.lock index eb28d6817..a3a3a90ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1987,22 +1987,17 @@ resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.5.3.tgz#f0a4de59394f210f2c2d9cda8ee35c716847d40e" integrity sha512-W66SS9n3ygYgD52r1GJr1WtYYOkcZsqdtMmDCEwDvkrmeARnHs2sAvj77Wt4PQG8JA7GwK5svIJr6rGccCaekw== -"@nimiq/core-web@^1.6.1": - version "1.6.1" - resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.6.1.tgz#97cb5b43b257c7f6f6808ef603e9bf686377241f" - integrity sha512-WYw2brIxUXa/SQ0JRp0RXWQKzBFhROXrEjF9Eh+tRlC+NrI2ObwRQkwJCbP2qmPtYldIimfyECmsDVHFoyLXjQ== - -"@nimiq/core-web@^1.6.2": +"@nimiq/core-web@1.6.3", "@nimiq/core-web@^1.6.2", "@nimiq/core-web@^1.6.3": version "1.6.3" resolved "https://registry.yarnpkg.com/@nimiq/core-web/-/core-web-1.6.3.tgz#b4a8f8c5d289850b20cb4009766af5b1cafd6e20" integrity sha512-D6RrJi2cRU81odNpmwczhUBvOQ47+/Db1svrTkH/G4xNd72lr9MS5nMdfpUz+rBRnSprljrzW2mdUtZ6W9bPaA== -"@nimiq/core@^1.6.1": - version "1.6.1" - resolved "https://registry.yarnpkg.com/@nimiq/core/-/core-1.6.1.tgz#5865c480dd3edbae5c91dccd16d369c5cb931556" - integrity sha512-F4Zso0CdCcZvDIhiCCZVnfZZIcHDtxm45emvItGdd1dM3jgoM/kiR1aQ4btvtZiNqjoNNlyK+zuIGW+/Lbnz2g== +"@nimiq/core@^1.6.3": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@nimiq/core/-/core-1.6.3.tgz#3aa28ddd438f33d893133d5b51bc2c9a00326e0d" + integrity sha512-UNUJNMhaS4VY0lTqx6Elw2CjDeqV9c+xl+QqavUrUbqeYawhs8aIZ2rzysstV5s3oPGaRE5YEDrWQXu9Qyhz9w== dependencies: - "@nimiq/jungle-db" "^0.10.0" + "@nimiq/jungle-db" "^0.11.0" atob "^2.0.3" bindings "^1.3.0" btoa "^1.1.2" @@ -2011,7 +2006,7 @@ json5 "^2.1.0" lodash.merge "^4.6.2" minimist "^1.2.8" - nan "^2.16.0" + nan "^2.19.0" node-deb "^0.10.7" ws "^7.0.1" @@ -2033,18 +2028,23 @@ dependencies: dom-parser "^0.1.5" -"@nimiq/jungle-db@^0.10.0": - version "0.10.0" - resolved "https://registry.yarnpkg.com/@nimiq/jungle-db/-/jungle-db-0.10.0.tgz#0b6d4e9502c15a4a45e519666fd60eb0ca586ba3" - integrity sha512-yCP/hTfUwommYhc7X/V0w4zGTIC/n8M7FPmyDEYrhDRVD5sYrH1KVysnm2M660HAFBjUVWN+3axAwn4n3f+khg== +"@nimiq/jungle-db@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@nimiq/jungle-db/-/jungle-db-0.11.0.tgz#a4c03c7e9814bc06f4343692f7e14aabdef3e1ee" + integrity sha512-Unt3tonnIP1WouwdhOjI2fIVRTAtaCqB5LroftYwchA+JV7f7WrKV8ABThW86QBueOnIZn0ItO03TnIzThHWUw== dependencies: atob "^2.0.3" btoa "^1.1.2" - node-lmdb "^0.9.6" + node-lmdb "^0.10.1" -"@nimiq/keyguard-client@https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&3be7f01c13d981d79296dc225b46a4fcb42c3a6c": - version "1.0.0" - resolved "https://gitpkg.vercel.app/nimiq/keyguard?scripts.postinstall=cd%20client%20%26%26%20.%2Fbuild-gitpkg.sh&3be7f01c13d981d79296dc225b46a4fcb42c3a6c#dd4feb2f56672b02f4c994398d2525758c4a7109" +"@nimiq/keyguard-client@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@nimiq/keyguard-client/-/keyguard-client-1.7.1.tgz#4d0772d81099653f264892eaf3ec811c0aa8bfff" + integrity sha512-EESuT/5SQ+LBvD0qDuOt3OizsfcXjvkhMEL4NnKjuHjEUSWO8aXsBQhVKP4R+zRPrJpPbZnsqROP5N6CDz7KAg== + dependencies: + "@nimiq/core-web" "1.6.3" + "@nimiq/rpc" "^0.3.0" + "@opengsn/common" "^2.2.5" "@nimiq/ledger-api@^3.0.0": version "3.0.0" @@ -2092,6 +2092,11 @@ resolved "https://registry.yarnpkg.com/@nimiq/rpc/-/rpc-0.1.5.tgz#53919b0a3a9abcdfebee0e865f4c663f72a8b8c2" integrity sha512-oTRThXzpbQOY8jz8h+2KXucWzW40nVfYBWROKXKBrSozhTG0nR+rzCbEm4ZyTC26b4RnmB6y4nYabUXi7gNWcA== +"@nimiq/rpc@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@nimiq/rpc/-/rpc-0.3.0.tgz#654c05acccc193b7d79fb09b2faf2114945ff872" + integrity sha512-je7fv+wP4nLEgTcZwu3FaGre22qkZ9AYGbStglVaJAxOH+3CvDnnOIa9IjGFaCEhtRQKRaQEvFqa5vN4IVnH+Q== + "@nimiq/rpc@^0.4.1": version "0.4.1" resolved "https://registry.yarnpkg.com/@nimiq/rpc/-/rpc-0.4.1.tgz#d5df1e426793afcdd8c407a2968442bbee874dbd" @@ -9721,11 +9726,16 @@ mz@^2.4.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.12.1, nan@^2.13.2, nan@^2.14.0, nan@^2.14.1, nan@^2.16.0: +nan@^2.12.1, nan@^2.13.2, nan@^2.14.0: version "2.17.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== +nan@^2.19.0: + version "2.22.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.0.tgz#31bc433fc33213c97bad36404bb68063de604de3" + integrity sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw== + nano-json-stream-parser@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" @@ -9828,11 +9838,16 @@ node-forge@^0.10.0: resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA== -node-gyp-build@^4.2.0, node-gyp-build@^4.2.3, node-gyp-build@^4.3.0: +node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: version "4.6.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055" integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ== +node-gyp-build@^4.8.1: + version "4.8.2" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.2.tgz#4f802b71c1ab2ca16af830e6c1ea7dd1ad9496fa" + integrity sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw== + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -9867,13 +9882,13 @@ node-libs-browser@^2.2.1: util "^0.11.0" vm-browserify "^1.0.1" -node-lmdb@^0.9.6: - version "0.9.7" - resolved "https://registry.yarnpkg.com/node-lmdb/-/node-lmdb-0.9.7.tgz#f518be2fd5922f445f9d11537753a5e938f1c5a1" - integrity sha512-RyYSB3kTByjp1yCKE474yuoBxi/+8kKvjYFOVuDBVoS31D6JvzjwMgNnQrMwoHSbZ6RwucW7jmF93Cm9ltziJQ== +node-lmdb@^0.10.1: + version "0.10.1" + resolved "https://registry.yarnpkg.com/node-lmdb/-/node-lmdb-0.10.1.tgz#e3e0e8e601fe0ea86e819c489c3185038de8ac51" + integrity sha512-hrao55cGl/gp0ybJa0bH8P28DeDoi2V1gWvwXcdPClO1YFymnqIOL3qmDqIjbVQViE7c5XwGHb4/sacmYZMK0A== dependencies: - nan "^2.14.1" - node-gyp-build "^4.2.3" + nan "^2.19.0" + node-gyp-build "^4.8.1" node-modules-regexp@^1.0.0: version "1.0.0"