Skip to content
Closed
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
11 changes: 5 additions & 6 deletions modules/sdk-coin-kaspa/src/kaspa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export abstract class AbstractKaspaLikeCoin extends AbstractUtxoCoin {
}

/**
* Kaspa family name is 'kaspa' for both mainnet and testnet.
* Kaspa family name is 'kas' for both mainnet and testnet.
* Override avoids going through names.ts which only knows Bitcoin-family coins.
* The cast is required because UtxoCoinNameMainnet is a closed union of Bitcoin-family coins;
* Kaspa manages its own network stack and is intentionally outside that union.
*/
getFamily(): UtxoCoinNameMainnet {
return 'kaspa' as unknown as UtxoCoinNameMainnet;
return 'kas' as unknown as UtxoCoinNameMainnet;
}

/**
Expand Down Expand Up @@ -141,8 +141,7 @@ export abstract class AbstractKaspaLikeCoin extends AbstractUtxoCoin {
throw new Error('Invalid keychains');
}

// Cast to string to avoid type-overlap lint until abstract-utxo dist is rebuilt with kaspa names.
const networkType = (this.name as string) === 'kaspa' ? 'mainnet' : 'testnet';
const networkType = (this.name as string) === 'kas' ? 'mainnet' : 'testnet';
const derivedAddress = new KaspaLib.KeyPair({ pub: keychains[0].pub }).getAddress(networkType);

if (derivedAddress !== address) {
Expand Down Expand Up @@ -338,7 +337,7 @@ export abstract class AbstractKaspaLikeCoin extends AbstractUtxoCoin {
}

export class Kaspa extends AbstractKaspaLikeCoin {
readonly name = 'kaspa' as UtxoCoinName;
readonly name = 'kas' as UtxoCoinName;

getFullName(): string {
return 'Kaspa';
Expand All @@ -354,7 +353,7 @@ export class Kaspa extends AbstractKaspaLikeCoin {
}

export class Tkaspa extends AbstractKaspaLikeCoin {
readonly name = 'tkaspa' as UtxoCoinName;
readonly name = 'tkas' as UtxoCoinName;

getFullName(): string {
return 'Testnet Kaspa';
Expand Down
4 changes: 2 additions & 2 deletions modules/sdk-coin-kaspa/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { BitGoBase } from '@bitgo/sdk-core';
import { Kaspa, Tkaspa } from './kaspa';

export const register = (sdk: BitGoBase): void => {
sdk.register('kaspa', Kaspa.createInstance);
sdk.register('tkaspa', Tkaspa.createInstance);
sdk.register('kas', Kaspa.createInstance);
sdk.register('tkas', Tkaspa.createInstance);
};
2 changes: 1 addition & 1 deletion modules/sdk-coin-kaspa/test/unit/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TransactionType } from '@bitgo/sdk-core';
import { SIGHASH_ALL } from '../../src/lib/constants';
import { KEYS, TRANSACTIONS } from '../fixtures/kaspa.fixtures';

const COIN = 'kaspa';
const COIN = 'kas';

describe('Kaspa Transaction', function () {
describe('Constructor', function () {
Expand Down
4 changes: 2 additions & 2 deletions modules/statics/src/allCoinsAndTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ export const allCoinsAndTokens = [
Networks.test.flrP,
UnderlyingAsset.FLRP
),
kaspa('3eebd6e4-b30a-4b37-819d-1e189372b5c9', 'kaspa', 'Kaspa', Networks.main.kaspa, UnderlyingAsset.KASPA),
kaspa('96b7ccfb-6130-43b2-a324-783f86752b94', 'tkaspa', 'Testnet Kaspa', Networks.test.kaspa, UnderlyingAsset.KASPA),
kaspa('3eebd6e4-b30a-4b37-819d-1e189372b5c9', 'kas', 'Kaspa', Networks.main.kaspa, UnderlyingAsset.KAS),
kaspa('96b7ccfb-6130-43b2-a324-783f86752b94', 'tkas', 'Testnet Kaspa', Networks.test.kaspa, UnderlyingAsset.KAS),
ada(
'fd4d125e-f14f-414b-bd17-6cb1393265f0',
'ada',
Expand Down
3 changes: 1 addition & 2 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export enum CoinFamily {
ISLM = 'islm',
JOVAYETH = 'jovayeth',
KAIA = 'kaia',
KASPA = 'kaspa',
KATANAETH = 'katanaeth', // Katana Network L2
KASPA = 'kas',
KAVACOSMOS = 'kavacosmos',
KAVAEVM = 'kavaevm',
LNBTC = 'lnbtc',
Expand Down Expand Up @@ -1364,7 +1364,6 @@ export enum UnderlyingAsset {
KARATE = 'karate',
KARMA = 'karma',
KAS = 'kas',
KASPA = 'kaspa',
KCASH = 'kcash',
KCS = 'kcs',
KEEP = 'keep',
Expand Down
Loading