@atomiqlabs/sdk 5.0.0-dev.7 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +272 -816
- package/dist/SmartChainAssets.d.ts +0 -20
- package/dist/SmartChainAssets.js +0 -20
- package/dist/SwapperFactory.d.ts +1 -3
- package/dist/SwapperFactory.js +1 -11
- package/package.json +3 -4
- package/src/SmartChainAssets.ts +0 -20
- package/src/SwapperFactory.ts +1 -15
|
@@ -79,25 +79,5 @@ export declare const SmartChainAssets: {
|
|
|
79
79
|
};
|
|
80
80
|
readonly name: "Starknet";
|
|
81
81
|
};
|
|
82
|
-
readonly CBTC: {
|
|
83
|
-
readonly pricing: {
|
|
84
|
-
readonly binancePair: "$fixed-100000000";
|
|
85
|
-
readonly okxPair: "$fixed-100000000";
|
|
86
|
-
readonly coinGeckoCoinId: "$fixed-100000000";
|
|
87
|
-
readonly coinPaprikaCoinId: "$fixed-100000000";
|
|
88
|
-
readonly krakenPair: "$fixed-100000000";
|
|
89
|
-
};
|
|
90
|
-
readonly name: "Citrea BTC";
|
|
91
|
-
};
|
|
92
|
-
readonly BBTC: {
|
|
93
|
-
readonly pricing: {
|
|
94
|
-
readonly binancePair: "$fixed-100000000";
|
|
95
|
-
readonly okxPair: "$fixed-100000000";
|
|
96
|
-
readonly coinGeckoCoinId: "$fixed-100000000";
|
|
97
|
-
readonly coinPaprikaCoinId: "$fixed-100000000";
|
|
98
|
-
readonly krakenPair: "$fixed-100000000";
|
|
99
|
-
};
|
|
100
|
-
readonly name: "Botanix BTC";
|
|
101
|
-
};
|
|
102
82
|
};
|
|
103
83
|
export type SmartChainAssetTickers = keyof typeof SmartChainAssets;
|
package/dist/SmartChainAssets.js
CHANGED
|
@@ -81,25 +81,5 @@ exports.SmartChainAssets = {
|
|
|
81
81
|
krakenPair: "STRKUSD;!XXBTZUSD"
|
|
82
82
|
},
|
|
83
83
|
name: "Starknet"
|
|
84
|
-
},
|
|
85
|
-
CBTC: {
|
|
86
|
-
pricing: {
|
|
87
|
-
binancePair: "$fixed-100000000",
|
|
88
|
-
okxPair: "$fixed-100000000",
|
|
89
|
-
coinGeckoCoinId: "$fixed-100000000",
|
|
90
|
-
coinPaprikaCoinId: "$fixed-100000000",
|
|
91
|
-
krakenPair: "$fixed-100000000"
|
|
92
|
-
},
|
|
93
|
-
name: "Citrea BTC"
|
|
94
|
-
},
|
|
95
|
-
BBTC: {
|
|
96
|
-
pricing: {
|
|
97
|
-
binancePair: "$fixed-100000000",
|
|
98
|
-
okxPair: "$fixed-100000000",
|
|
99
|
-
coinGeckoCoinId: "$fixed-100000000",
|
|
100
|
-
coinPaprikaCoinId: "$fixed-100000000",
|
|
101
|
-
krakenPair: "$fixed-100000000"
|
|
102
|
-
},
|
|
103
|
-
name: "Botanix BTC"
|
|
104
84
|
}
|
|
105
85
|
};
|
package/dist/SwapperFactory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainData, BitcoinNetwork, BitcoinRpc, BaseTokenType, ChainType, StorageObject, IStorageManager
|
|
1
|
+
import { ChainData, BitcoinNetwork, BitcoinRpc, BaseTokenType, ChainType, StorageObject, IStorageManager } from "@atomiqlabs/base";
|
|
2
2
|
import { BtcToken, CustomPriceFunction, MempoolApi, MempoolBitcoinRpc, SCToken, Swapper, SwapperOptions } from "@atomiqlabs/sdk-lib";
|
|
3
3
|
type ChainInitializer<O, C extends ChainType, T extends BaseTokenType> = {
|
|
4
4
|
chainId: ChainType["ChainId"];
|
|
@@ -33,7 +33,6 @@ export type MultichainSwapperOptions<T extends readonly ChainInitializer<any, an
|
|
|
33
33
|
chainStorageCtor?: <T extends StorageObject>(name: string) => IStorageManager<T>;
|
|
34
34
|
pricingFeeDifferencePPM?: bigint;
|
|
35
35
|
mempoolApi?: MempoolApi | MempoolBitcoinRpc | string | string[];
|
|
36
|
-
messenger?: Messenger;
|
|
37
36
|
getPriceFn?: CustomPriceFunction;
|
|
38
37
|
};
|
|
39
38
|
export declare class SwapperFactory<T extends readonly ChainInitializer<any, any, any>[]> {
|
|
@@ -47,6 +46,5 @@ export declare class SwapperFactory<T extends readonly ChainInitializer<any, any
|
|
|
47
46
|
TokenResolver: GetAllTokenResolvers<T>;
|
|
48
47
|
constructor(initializers: T);
|
|
49
48
|
newSwapper(options: MultichainSwapperOptions<T>): Swapper<ToMultichain<T>>;
|
|
50
|
-
newSwapperInitialized(options: MultichainSwapperOptions<T>): Promise<Swapper<ToMultichain<T>>>;
|
|
51
49
|
}
|
|
52
50
|
export {};
|
package/dist/SwapperFactory.js
CHANGED
|
@@ -5,7 +5,6 @@ const base_1 = require("@atomiqlabs/base");
|
|
|
5
5
|
const sdk_lib_1 = require("@atomiqlabs/sdk-lib");
|
|
6
6
|
const SmartChainAssets_1 = require("./SmartChainAssets");
|
|
7
7
|
const LocalStorageManager_1 = require("./storage/LocalStorageManager");
|
|
8
|
-
const messenger_nostr_1 = require("@atomiqlabs/messenger-nostr");
|
|
9
8
|
const registries = {
|
|
10
9
|
[base_1.BitcoinNetwork.MAINNET]: "https://api.github.com/repos/adambor/SolLightning-registry/contents/registry-mainnet.json?ref=main",
|
|
11
10
|
[base_1.BitcoinNetwork.TESTNET]: "https://api.github.com/repos/adambor/SolLightning-registry/contents/registry.json?ref=main",
|
|
@@ -38,9 +37,6 @@ const mempoolUrls = {
|
|
|
38
37
|
"https://mempool.tk7.mempool.space/testnet4/api/"
|
|
39
38
|
]
|
|
40
39
|
};
|
|
41
|
-
const nostrUrls = [
|
|
42
|
-
"wss://relay.damus.io", "wss://nostr.einundzwanzig.space", "wss://nostr.mutinywallet.com"
|
|
43
|
-
];
|
|
44
40
|
class SwapperFactory {
|
|
45
41
|
constructor(initializers) {
|
|
46
42
|
this.initializers = initializers;
|
|
@@ -72,7 +68,6 @@ class SwapperFactory {
|
|
|
72
68
|
newSwapper(options) {
|
|
73
69
|
options.bitcoinNetwork ?? (options.bitcoinNetwork = base_1.BitcoinNetwork.MAINNET);
|
|
74
70
|
options.storagePrefix ?? (options.storagePrefix = "atomiqsdk-" + options.bitcoinNetwork + "-");
|
|
75
|
-
options.messenger ?? (options.messenger = new messenger_nostr_1.NostrMessenger(options.bitcoinNetwork, nostrUrls));
|
|
76
71
|
options.defaultTrustedIntermediaryUrl ?? (options.defaultTrustedIntermediaryUrl = trustedIntermediaries[options.bitcoinNetwork]);
|
|
77
72
|
options.registryUrl ?? (options.registryUrl = registries[options.bitcoinNetwork]);
|
|
78
73
|
const mempoolApi = options.mempoolApi ?? new sdk_lib_1.MempoolBitcoinRpc(mempoolUrls[options.bitcoinNetwork]);
|
|
@@ -107,12 +102,7 @@ class SwapperFactory {
|
|
|
107
102
|
};
|
|
108
103
|
}), options.getPriceFn)) :
|
|
109
104
|
sdk_lib_1.RedundantSwapPrice.createFromTokenMap(options.pricingFeeDifferencePPM ?? 10000n, pricingAssets);
|
|
110
|
-
return new sdk_lib_1.Swapper(bitcoinRpc, chains, swapPricing, pricingAssets, options
|
|
111
|
-
}
|
|
112
|
-
async newSwapperInitialized(options) {
|
|
113
|
-
const swapper = this.newSwapper(options);
|
|
114
|
-
await swapper.init();
|
|
115
|
-
return swapper;
|
|
105
|
+
return new sdk_lib_1.Swapper(bitcoinRpc, chains, swapPricing, pricingAssets, options);
|
|
116
106
|
}
|
|
117
107
|
}
|
|
118
108
|
exports.SwapperFactory = SwapperFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "atomiq labs SDK for cross-chain swaps between smart chains and bitcoin",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types:": "./dist/index.d.ts",
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
"author": "adambor",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atomiqlabs/base": "^
|
|
25
|
-
"@atomiqlabs/
|
|
26
|
-
"@atomiqlabs/sdk-lib": "^14.0.0-dev.75"
|
|
24
|
+
"@atomiqlabs/base": "^11.0.0",
|
|
25
|
+
"@atomiqlabs/sdk-lib": "^15.0.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@types/node": "22.13.5",
|
package/src/SmartChainAssets.ts
CHANGED
|
@@ -80,26 +80,6 @@ export const SmartChainAssets = {
|
|
|
80
80
|
krakenPair: "STRKUSD;!XXBTZUSD"
|
|
81
81
|
},
|
|
82
82
|
name: "Starknet"
|
|
83
|
-
},
|
|
84
|
-
CBTC: {
|
|
85
|
-
pricing: {
|
|
86
|
-
binancePair: "$fixed-100000000",
|
|
87
|
-
okxPair: "$fixed-100000000",
|
|
88
|
-
coinGeckoCoinId: "$fixed-100000000",
|
|
89
|
-
coinPaprikaCoinId: "$fixed-100000000",
|
|
90
|
-
krakenPair: "$fixed-100000000"
|
|
91
|
-
},
|
|
92
|
-
name: "Citrea BTC"
|
|
93
|
-
},
|
|
94
|
-
BBTC: {
|
|
95
|
-
pricing: {
|
|
96
|
-
binancePair: "$fixed-100000000",
|
|
97
|
-
okxPair: "$fixed-100000000",
|
|
98
|
-
coinGeckoCoinId: "$fixed-100000000",
|
|
99
|
-
coinPaprikaCoinId: "$fixed-100000000",
|
|
100
|
-
krakenPair: "$fixed-100000000"
|
|
101
|
-
},
|
|
102
|
-
name: "Botanix BTC"
|
|
103
83
|
}
|
|
104
84
|
} as const;
|
|
105
85
|
|
package/src/SwapperFactory.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
BaseTokenType,
|
|
6
6
|
ChainType,
|
|
7
7
|
StorageObject,
|
|
8
|
-
IStorageManager
|
|
8
|
+
IStorageManager
|
|
9
9
|
} from "@atomiqlabs/base";
|
|
10
10
|
import {
|
|
11
11
|
BitcoinTokens,
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from "@atomiqlabs/sdk-lib";
|
|
18
18
|
import {SmartChainAssets} from "./SmartChainAssets";
|
|
19
19
|
import {LocalStorageManager} from "./storage/LocalStorageManager";
|
|
20
|
-
import {NostrMessenger} from "@atomiqlabs/messenger-nostr";
|
|
21
20
|
|
|
22
21
|
type ChainInitializer<O, C extends ChainType, T extends BaseTokenType> = {
|
|
23
22
|
chainId: ChainType["ChainId"],
|
|
@@ -68,7 +67,6 @@ export type MultichainSwapperOptions<T extends readonly ChainInitializer<any, an
|
|
|
68
67
|
chainStorageCtor?: <T extends StorageObject>(name: string) => IStorageManager<T>,
|
|
69
68
|
pricingFeeDifferencePPM?: bigint,
|
|
70
69
|
mempoolApi?: MempoolApi | MempoolBitcoinRpc | string | string[],
|
|
71
|
-
messenger?: Messenger,
|
|
72
70
|
getPriceFn?: CustomPriceFunction
|
|
73
71
|
};
|
|
74
72
|
|
|
@@ -107,10 +105,6 @@ const mempoolUrls = {
|
|
|
107
105
|
]
|
|
108
106
|
}
|
|
109
107
|
|
|
110
|
-
const nostrUrls: string[] = [
|
|
111
|
-
"wss://relay.damus.io", "wss://nostr.einundzwanzig.space", "wss://nostr.mutinywallet.com"
|
|
112
|
-
];
|
|
113
|
-
|
|
114
108
|
export class SwapperFactory<T extends readonly ChainInitializer<any, any, any>[]> {
|
|
115
109
|
|
|
116
110
|
Tokens: GetAllTokens<T> & {
|
|
@@ -152,7 +146,6 @@ export class SwapperFactory<T extends readonly ChainInitializer<any, any, any>[]
|
|
|
152
146
|
newSwapper(options: MultichainSwapperOptions<T>) {
|
|
153
147
|
options.bitcoinNetwork ??= BitcoinNetwork.MAINNET as any;
|
|
154
148
|
options.storagePrefix ??= "atomiqsdk-"+options.bitcoinNetwork+"-";
|
|
155
|
-
options.messenger ??= new NostrMessenger(options.bitcoinNetwork, nostrUrls);
|
|
156
149
|
|
|
157
150
|
options.defaultTrustedIntermediaryUrl ??= trustedIntermediaries[options.bitcoinNetwork];
|
|
158
151
|
|
|
@@ -198,15 +191,8 @@ export class SwapperFactory<T extends readonly ChainInitializer<any, any, any>[]
|
|
|
198
191
|
chains as any,
|
|
199
192
|
swapPricing,
|
|
200
193
|
pricingAssets,
|
|
201
|
-
options.messenger,
|
|
202
194
|
options
|
|
203
195
|
);
|
|
204
196
|
}
|
|
205
197
|
|
|
206
|
-
async newSwapperInitialized(options: MultichainSwapperOptions<T>) {
|
|
207
|
-
const swapper = this.newSwapper(options);
|
|
208
|
-
await swapper.init();
|
|
209
|
-
return swapper;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
198
|
}
|