Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions migration/1773740800000-AddEdgeWallet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = class AddEdgeWallet1773740800000 {
name = 'AddEdgeWallet1773740800000';

async up(queryRunner) {
await queryRunner.query(`
IF NOT EXISTS (SELECT 1 FROM "dbo"."wallet" WHERE "name" = 'Edge')
INSERT INTO "dbo"."wallet" (
"name", "isKycClient", "amlRules", "autoTradeApproval",
"mailConfig", "usesDummyAddresses", "displayFraudWarning", "buySpecificIbanEnabled"
) VALUES (
'Edge', 0, '0', 1,
'BuyCrypto;BuyFiat;RefReward;Info', 0, 0, 0
)
`);
}

async down(queryRunner) {
await queryRunner.query(`DELETE FROM "dbo"."wallet" WHERE "name" = 'Edge'`);
}
};
19 changes: 16 additions & 3 deletions src/integration/blockchain/shared/util/blockchain.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ export function txExplorerUrl(blockchain: Blockchain, txId: string): string | un
const txPath = TxPaths[blockchain];
if (!baseUrl || !txPath) return undefined;

// ICP token txIds have format "canisterId:blockIndex" — extract block index only
// ICP token txIds have format "canisterId:blockIndex"
if (blockchain === Blockchain.INTERNET_COMPUTER && txId.includes(':')) {
const blockIndex = txId.split(':')[1];
return `${baseUrl}/${txPath}/${blockIndex}`;
return icpTokenTxUrl(baseUrl, txPath, txId);
}

return `${baseUrl}/${txPath}/${txId}`;
Expand All @@ -73,6 +72,20 @@ export function addressExplorerUrl(blockchain: Blockchain, address: string): str

// --- HELPERS --- //

// ICP token canister ID to dashboard path mapping
const IcpTokenDashboardPaths: Record<string, string> = {
'mxzaz-hqaaa-aaaar-qaada-cai': 'bitcoin', // ckBTC
};

function icpTokenTxUrl(baseUrl: string, txPath: string, txId: string): string | undefined {
const [canisterId, blockIndex] = txId.split(':');

const tokenPath = IcpTokenDashboardPaths[canisterId];
if (!tokenPath) return undefined;

return `${baseUrl}/${tokenPath}/${txPath}/${blockIndex}`;
}

const BlockchainExplorerUrls: { [b in Blockchain]: string } = {
[Blockchain.DEFICHAIN]: 'https://defiscan.live',
[Blockchain.BITCOIN]: 'https://mempool.space',
Expand Down
4 changes: 2 additions & 2 deletions src/shared/models/asset/dto/asset-dto.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class AssetDtoMapper {
sellable: asset.sellable,
instantBuyable: asset.instantBuyable,
instantSellable: asset.instantSellable,
cardBuyable: asset.cardBuyable,
cardSellable: asset.cardSellable,
cardBuyable: false,
cardSellable: false,
blockchain: asset.blockchain,
sortOrder: asset.sortOrder,
};
Expand Down
9 changes: 3 additions & 6 deletions src/shared/models/fiat/dto/fiat-dto.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class FiatDtoMapper {
name: fiat.name,
buyable: fiat.buyable,
sellable: fiat.sellable,
cardBuyable: fiat.cardBuyable,
cardSellable: fiat.cardSellable,
cardBuyable: false,
cardSellable: false,
instantBuyable: fiat.instantBuyable,
instantSellable: fiat.instantSellable,
};
Expand All @@ -37,10 +37,7 @@ export class FiatDtoMapper {
fiat.instantBuyable || fiat.instantSellable
? this.convert(spec.minVolume, Config.tradingLimits.yearlyDefault, fiat)
: this.zeroLimits,
[FiatPaymentMethod.CARD]:
fiat.cardBuyable || fiat.cardSellable
? this.convert(spec.minVolume, Config.tradingLimits.cardDefault, fiat)
: this.zeroLimits,
[FiatPaymentMethod.CARD]: this.zeroLimits,
},
allowedIbanCountries,
});
Expand Down
5 changes: 1 addition & 4 deletions src/shared/services/payment-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ export class PaymentInfoService {
throw this.createError('Asset blockchain mismatch', QuoteError.ASSET_UNSUPPORTED, forQuote);

if ('paymentMethod' in dto && dto.paymentMethod === FiatPaymentMethod.CARD) {
if (!dto.currency.cardSellable)
throw this.createError('Currency not sellable via Card', QuoteError.CURRENCY_UNSUPPORTED, forQuote);
if (!dto.asset.cardBuyable)
throw this.createError('Asset not buyable via Card', QuoteError.ASSET_UNSUPPORTED, forQuote);
throw this.createError('Card payments are not supported', QuoteError.PAYMENT_METHOD_NOT_ALLOWED, forQuote);
} else if ('paymentMethod' in dto && dto.paymentMethod === FiatPaymentMethod.INSTANT) {
if (!dto.currency.instantSellable)
throw this.createError('Currency not sellable via Instant', QuoteError.CURRENCY_UNSUPPORTED, forQuote);
Expand Down
Loading