From 5d9d841fddc30404d21b5be290edd4fe6e23edd6 Mon Sep 17 00:00:00 2001 From: Bernd Date: Tue, 17 Mar 2026 09:57:19 +0100 Subject: [PATCH 1/2] fix: update ICP payment URI to include canister ID Change URI format from icp:{address}?amount={amount} to icp:{canister-id}/transfer?to={principal}&amount={amount} for both ICP native and all ICRC tokens. --- src/integration/blockchain/icp/services/icp.service.ts | 8 ++++++-- .../blockchain/shared/services/crypto.service.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/integration/blockchain/icp/services/icp.service.ts b/src/integration/blockchain/icp/services/icp.service.ts index 97bbeb1fa8..cd6a76126b 100644 --- a/src/integration/blockchain/icp/services/icp.service.ts +++ b/src/integration/blockchain/icp/services/icp.service.ts @@ -2,6 +2,7 @@ import { Principal } from '@dfinity/principal'; import { Injectable } from '@nestjs/common'; import { secp256k1 } from '@noble/curves/secp256k1'; import { sha256 } from '@noble/hashes/sha2'; +import { Asset, AssetType } from 'src/shared/models/asset/asset.entity'; import { HttpService } from 'src/shared/services/http.service'; import { Util } from 'src/shared/utils/util'; import nacl from 'tweetnacl'; @@ -23,8 +24,11 @@ export class InternetComputerService extends BlockchainService { return this.client; } - getPaymentRequest(address: string, amount: number): string { - return `icp:${address}?amount=${Util.numberToFixedString(amount)}`; + private static readonly ICP_NATIVE_LEDGER = 'ryjl3-tyaaa-aaaaa-aaaba-cai'; + + getPaymentRequest(address: string, amount: number, asset?: Asset): string { + const canisterId = asset?.type === AssetType.TOKEN ? asset.chainId : InternetComputerService.ICP_NATIVE_LEDGER; + return `icp:${canisterId}/transfer?to=${address}&amount=${Util.numberToFixedString(amount)}`; } async verifySignature(message: string, address: string, signature: string, key?: string): Promise { diff --git a/src/integration/blockchain/shared/services/crypto.service.ts b/src/integration/blockchain/shared/services/crypto.service.ts index a2d5971487..7e5da538d0 100644 --- a/src/integration/blockchain/shared/services/crypto.service.ts +++ b/src/integration/blockchain/shared/services/crypto.service.ts @@ -105,7 +105,7 @@ export class CryptoService { return this.cardanoService.getPaymentRequest(address, amount); case Blockchain.INTERNET_COMPUTER: - return this.internetComputerService.getPaymentRequest(address, amount); + return this.internetComputerService.getPaymentRequest(address, amount, asset); default: return undefined; From 0908435403e21f43d7903f7ae26760776facb7f1 Mon Sep 17 00:00:00 2001 From: Bernd Date: Tue, 17 Mar 2026 09:59:21 +0100 Subject: [PATCH 2/2] refactor: use Config for ICP native ledger canister ID instead of hardcoded constant --- src/integration/blockchain/icp/services/icp.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/integration/blockchain/icp/services/icp.service.ts b/src/integration/blockchain/icp/services/icp.service.ts index cd6a76126b..465b6937fe 100644 --- a/src/integration/blockchain/icp/services/icp.service.ts +++ b/src/integration/blockchain/icp/services/icp.service.ts @@ -2,6 +2,7 @@ import { Principal } from '@dfinity/principal'; import { Injectable } from '@nestjs/common'; import { secp256k1 } from '@noble/curves/secp256k1'; import { sha256 } from '@noble/hashes/sha2'; +import { Config } from 'src/config/config'; import { Asset, AssetType } from 'src/shared/models/asset/asset.entity'; import { HttpService } from 'src/shared/services/http.service'; import { Util } from 'src/shared/utils/util'; @@ -24,10 +25,11 @@ export class InternetComputerService extends BlockchainService { return this.client; } - private static readonly ICP_NATIVE_LEDGER = 'ryjl3-tyaaa-aaaaa-aaaba-cai'; - getPaymentRequest(address: string, amount: number, asset?: Asset): string { - const canisterId = asset?.type === AssetType.TOKEN ? asset.chainId : InternetComputerService.ICP_NATIVE_LEDGER; + const canisterId = + asset?.type === AssetType.TOKEN + ? asset.chainId + : Config.blockchain.internetComputer.internetComputerLedgerCanisterId; return `icp:${canisterId}/transfer?to=${address}&amount=${Util.numberToFixedString(amount)}`; }