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
3 changes: 3 additions & 0 deletions modules/sdk-core/src/bitgo/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ interface EnvironmentTemplate {
sgbExplorerBaseUrl?: string;
sgbExplorerApiToken?: string;
icpNodeUrl: string;
kaspaNodeUrl: string;
hyperLiquidNodeUrl: string;
wemixExplorerBaseUrl?: string;
wemixExplorerApiToken?: string;
Expand Down Expand Up @@ -358,6 +359,7 @@ const mainnetBase: EnvironmentTemplate = {
},
},
icpNodeUrl: 'https://ic0.app',
kaspaNodeUrl: 'https://api.kaspa.org',
hyperLiquidNodeUrl: 'https://api.hyperliquid.xyz',
worldExplorerBaseUrl: 'https://worldscan.org/',
somniaExplorerBaseUrl: 'https://mainnet.somnia.w3us.site/',
Expand Down Expand Up @@ -436,6 +438,7 @@ const testnetBase: EnvironmentTemplate = {
xdcExplorerBaseUrl: 'https://api.etherscan.io/v2',
sgbExplorerBaseUrl: 'https://coston-explorer.flare.network',
icpNodeUrl: 'https://ic0.app',
kaspaNodeUrl: 'https://api-tn10.kaspa.org',
hyperLiquidNodeUrl: 'https://api.hyperliquid-testnet.xyz',
monExplorerBaseUrl: 'https://api.etherscan.io/v2',
worldExplorerBaseUrl: 'https://sepolia.worldscan.org/',
Expand Down
3 changes: 3 additions & 0 deletions modules/statics/src/allCoinsAndTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import { polyxTokens } from './coins/polyxTokens';
import { cantonTokens } from './coins/cantonTokens';
import { flrp } from './flrp';
import { hypeEvm } from './hypeevm';
import { kaspa } from './kaspa';
import {
ACCOUNT_COIN_DEFAULT_FEATURES_EXCLUDE_SINGAPORE_AND_MENA_FZE,
ADA_FEATURES,
Expand Down Expand Up @@ -187,6 +188,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),
ada(
'fd4d125e-f14f-414b-bd17-6cb1393265f0',
'ada',
Expand Down
3 changes: 3 additions & 0 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export enum CoinFamily {
ISLM = 'islm',
JOVAYETH = 'jovayeth',
KAIA = 'kaia',
KASPA = 'kaspa',
KAVACOSMOS = 'kavacosmos',
KAVAEVM = 'kavaevm',
LNBTC = 'lnbtc',
Expand Down Expand Up @@ -1323,6 +1324,7 @@ export enum UnderlyingAsset {
KARATE = 'karate',
KARMA = 'karma',
KAS = 'kas',
KASPA = 'kaspa',
KCASH = 'kcash',
KCS = 'kcs',
KEEP = 'keep',
Expand Down Expand Up @@ -3853,6 +3855,7 @@ export enum BaseUnit {
TCRONOS = 'basetcro',
TASI = 'atestfet',
CANTON = 'canton',
KASPA = 'sompi',
USDC = 'usdc',
}

Expand Down
1 change: 1 addition & 0 deletions modules/statics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './coins';
export * from './networks';
export * from './errors';
export * from './tokenConfig';
export { KaspaCoin } from './kaspa';
export { OfcCoin } from './ofc';
export { UtxoCoin } from './utxo';
export { LightningCoin } from './lightning';
Expand Down
90 changes: 90 additions & 0 deletions modules/statics/src/kaspa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { BaseCoin, BaseUnit, CoinFeature, CoinKind, KeyCurve, UnderlyingAsset } from './base';
import { KaspaMainnet, KaspaTestnet } from './networks';

export interface KaspaConstructorOptions {
id: string;
fullName: string;
name: string;
network: KaspaMainnet | KaspaTestnet;
features: CoinFeature[];
asset: UnderlyingAsset;
prefix?: string;
suffix?: string;
primaryKeyCurve: KeyCurve;
}

export class KaspaCoin extends BaseCoin {
public static readonly DEFAULT_FEATURES = [
CoinFeature.UNSPENT_MODEL,
CoinFeature.TSS,
CoinFeature.TSS_COLD,
CoinFeature.CUSTODY,
CoinFeature.CUSTODY_BITGO_TRUST,
CoinFeature.CUSTODY_BITGO_INDIA,
CoinFeature.CUSTODY_BITGO_MENA_FZE,
CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE,
CoinFeature.CUSTODY_BITGO_GERMANY,
CoinFeature.CUSTODY_BITGO_FRANKFURT,
];

public readonly network: KaspaMainnet | KaspaTestnet;

constructor(options: KaspaConstructorOptions) {
super({
...options,
kind: CoinKind.CRYPTO,
isToken: false,
decimalPlaces: 8,
baseUnit: BaseUnit.KASPA,
});

this.network = options.network;
}

protected disallowedFeatures(): Set<CoinFeature> {
return new Set([CoinFeature.ACCOUNT_MODEL]);
}

protected requiredFeatures(): Set<CoinFeature> {
return new Set([CoinFeature.UNSPENT_MODEL]);
}
}

/**
* Factory function for Kaspa coin instances.
*
* @param id uuid v4
* @param name unique identifier of the coin
* @param fullName Complete human-readable name of the coin
* @param network Network object for this coin
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `KaspaCoin`
* @param prefix? Optional coin prefix. Defaults to empty string
* @param suffix? Optional coin suffix. Defaults to coin name.
* @param primaryKeyCurve The elliptic curve for this chain/token
*/
export function kaspa(
id: string,
name: string,
fullName: string,
network: KaspaMainnet | KaspaTestnet,
asset: UnderlyingAsset,
features: CoinFeature[] = KaspaCoin.DEFAULT_FEATURES,
prefix = '',
suffix: string = name.toUpperCase(),
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
) {
return Object.freeze(
new KaspaCoin({
id,
name,
fullName,
network,
prefix,
suffix,
features,
asset,
primaryKeyCurve,
})
);
}
16 changes: 16 additions & 0 deletions modules/statics/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ class IcpTestnet extends Testnet implements AccountNetwork {
accountExplorerUrl = 'https://dashboard.internetcomputer.org/account/';
}

export class KaspaMainnet extends Mainnet implements AccountNetwork {
name = 'Kaspa';
family = CoinFamily.KASPA;
explorerUrl = 'https://explorer.kaspa.org/txs/';
accountExplorerUrl = 'https://explorer.kaspa.org/addresses/';
}

export class KaspaTestnet extends Testnet implements AccountNetwork {
name = 'Testnet Kaspa';
family = CoinFamily.KASPA;
explorerUrl = 'https://explorer-tn10.kaspa.org/txs/';
accountExplorerUrl = 'https://explorer-tn10.kaspa.org/addresses/';
}

class Arbitrum extends Mainnet implements EthereumNetwork {
name = 'Arbitrum';
family = CoinFamily.ARBETH;
Expand Down Expand Up @@ -2762,6 +2776,7 @@ export const Networks = {
islm: Object.freeze(new Islm()),
jovayeth: Object.freeze(new JovayETH()),
kaia: Object.freeze(new Kaia()),
kaspa: Object.freeze(new KaspaMainnet()),
kavacosmos: Object.freeze(new KavaCosmos()),
kavaevm: Object.freeze(new KavaEVM()),
lnbtc: Object.freeze(new LightningBitcoin()),
Expand Down Expand Up @@ -2888,6 +2903,7 @@ export const Networks = {
irys: Object.freeze(new IrysTestnet()),
islm: Object.freeze(new IslmTestnet()),
jovayeth: Object.freeze(new JovayETHTestnet()),
kaspa: Object.freeze(new KaspaTestnet()),
kavacosmos: Object.freeze(new KavaCosmosTestnet()),
kavaevm: Object.freeze(new KavaEVMTestnet()),
kovan: Object.freeze(new Kovan()),
Expand Down
2 changes: 2 additions & 0 deletions modules/statics/test/unit/fixtures/expectedColdFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const expectedColdFeatures = {
'injective',
'jovayeth',
'kaia',
'kaspa',
'kavacosmos',
'megaeth',
'mantle',
Expand Down Expand Up @@ -205,6 +206,7 @@ export const expectedColdFeatures = {
'tinjective',
'tiota',
'tkaia',
'tkaspa',
'tkavacosmos',
'tmantle',
'tmantra',
Expand Down
Loading