@atomiqlabs/chain-solana 13.0.11 → 13.2.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 +73 -0
- package/dist/index.d.ts +70 -1
- package/dist/index.js +72 -2
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.js +13 -0
- package/dist/solana/SolanaInitializer.d.ts +31 -1
- package/dist/solana/SolanaInitializer.js +10 -1
- package/dist/solana/btcrelay/SolanaBtcRelay.d.ts +42 -6
- package/dist/solana/btcrelay/SolanaBtcRelay.js +56 -24
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.d.ts +59 -7
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.js +33 -0
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.d.ts +47 -5
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.js +30 -3
- package/dist/solana/chain/SolanaAction.js +4 -3
- package/dist/solana/chain/SolanaChainInterface.d.ts +73 -4
- package/dist/solana/chain/SolanaChainInterface.js +35 -4
- package/dist/solana/chain/SolanaModule.js +2 -2
- package/dist/solana/chain/modules/SolanaFees.d.ts +75 -8
- package/dist/solana/chain/modules/SolanaFees.js +61 -8
- package/dist/solana/chain/modules/SolanaSlots.js +2 -2
- package/dist/solana/chain/modules/SolanaTransactions.d.ts +13 -3
- package/dist/solana/chain/modules/SolanaTransactions.js +13 -9
- package/dist/solana/connection/ConnectionWithRetries.d.ts +35 -0
- package/dist/solana/connection/ConnectionWithRetries.js +71 -0
- package/dist/solana/events/SolanaChainEvents.d.ts +7 -1
- package/dist/solana/events/SolanaChainEvents.js +6 -0
- package/dist/solana/events/SolanaChainEventsBrowser.d.ts +48 -4
- package/dist/solana/events/SolanaChainEventsBrowser.js +28 -6
- package/dist/solana/program/SolanaProgramBase.d.ts +21 -10
- package/dist/solana/program/SolanaProgramBase.js +9 -4
- package/dist/solana/swaps/SolanaSwapData.d.ts +90 -5
- package/dist/solana/swaps/SolanaSwapData.js +29 -5
- package/dist/solana/swaps/SolanaSwapProgram.d.ts +78 -16
- package/dist/solana/swaps/SolanaSwapProgram.js +78 -29
- package/dist/solana/swaps/modules/SolanaDataAccount.js +2 -2
- package/dist/solana/swaps/modules/SolanaLpVault.js +9 -9
- package/dist/solana/swaps/modules/SwapClaim.js +9 -9
- package/dist/solana/swaps/modules/SwapInit.js +18 -18
- package/dist/solana/swaps/modules/SwapRefund.js +9 -9
- package/dist/solana/wallet/SolanaKeypairWallet.d.ts +16 -0
- package/dist/solana/wallet/SolanaKeypairWallet.js +13 -0
- package/dist/solana/wallet/SolanaSigner.d.ts +12 -0
- package/dist/solana/wallet/SolanaSigner.js +6 -0
- package/node/index.d.ts +1 -0
- package/node/index.js +3 -0
- package/package.json +6 -4
- package/src/index.ts +71 -1
- package/src/node/index.ts +9 -0
- package/src/solana/SolanaInitializer.ts +31 -1
- package/src/solana/btcrelay/SolanaBtcRelay.ts +66 -31
- package/src/solana/btcrelay/headers/SolanaBtcHeader.ts +63 -8
- package/src/solana/btcrelay/headers/SolanaBtcStoredHeader.ts +51 -9
- package/src/solana/chain/SolanaAction.ts +4 -3
- package/src/solana/chain/SolanaChainInterface.ts +80 -7
- package/src/solana/chain/SolanaModule.ts +2 -2
- package/src/solana/chain/modules/SolanaFees.ts +76 -9
- package/src/solana/chain/modules/SolanaSlots.ts +2 -2
- package/src/solana/chain/modules/SolanaTransactions.ts +23 -9
- package/src/solana/connection/ConnectionWithRetries.ts +96 -0
- package/src/solana/events/SolanaChainEvents.ts +7 -1
- package/src/solana/events/SolanaChainEventsBrowser.ts +50 -7
- package/src/solana/program/SolanaProgramBase.ts +24 -9
- package/src/solana/swaps/SolanaSwapData.ts +90 -5
- package/src/solana/swaps/SolanaSwapProgram.ts +101 -36
- package/src/solana/swaps/modules/SolanaDataAccount.ts +2 -2
- package/src/solana/swaps/modules/SolanaLpVault.ts +9 -9
- package/src/solana/swaps/modules/SwapClaim.ts +9 -9
- package/src/solana/swaps/modules/SwapInit.ts +18 -18
- package/src/solana/swaps/modules/SwapRefund.ts +9 -9
- package/src/solana/wallet/SolanaKeypairWallet.ts +16 -0
- package/src/solana/wallet/SolanaSigner.ts +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @atomiqlabs/chain-solana
|
|
2
|
+
|
|
3
|
+
`@atomiqlabs/chain-solana` is the Solana integration package for the Atomiq protocol.
|
|
4
|
+
|
|
5
|
+
Within the Atomiq stack, this library provides the Solana-side building blocks used for Bitcoin-aware swaps on Solana. It includes:
|
|
6
|
+
|
|
7
|
+
- the `SolanaInitializer` used to register Solana support in the Atomiq SDK
|
|
8
|
+
- the `SolanaChainInterface` used to talk to Solana RPCs
|
|
9
|
+
- Solana BTC relay and swap program wrappers
|
|
10
|
+
- signer and wallet helpers for Solana integrations
|
|
11
|
+
- connection retry and chain event utilities
|
|
12
|
+
|
|
13
|
+
This package is intended for direct protocol integrations and for higher-level Atomiq SDK layers that need Solana chain support.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the package with its `@solana/web3.js` peer dependency:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @atomiqlabs/chain-solana @solana/web3.js
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Node-only Classes
|
|
24
|
+
|
|
25
|
+
The default package entrypoint stays browser-safe and does not export classes that depend on Node's `fs` module.
|
|
26
|
+
|
|
27
|
+
Import backend-only utilities from the dedicated `node` subpath:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import {SolanaChainEvents} from "@atomiqlabs/chain-solana/node";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Supported Chains
|
|
34
|
+
|
|
35
|
+
This package exports a single Solana initializer:
|
|
36
|
+
|
|
37
|
+
- Solana via `SolanaInitializer`
|
|
38
|
+
|
|
39
|
+
Canonical deployments currently defined in this package:
|
|
40
|
+
|
|
41
|
+
| Chain | Canonical deployments included |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Solana | `MAINNET`, `TESTNET` |
|
|
44
|
+
|
|
45
|
+
In this package, the selected Bitcoin network determines which canonical Solana program addresses are used by default. `BitcoinNetwork.TESTNET4` is not wired to a Solana deployment here yet.
|
|
46
|
+
|
|
47
|
+
The Solana implementation doesn't support the UTXO-controlled vault (SPV vault) contract, hence it can only process legacy HTLC & PrTLC based swaps.
|
|
48
|
+
|
|
49
|
+
## SDK Example
|
|
50
|
+
|
|
51
|
+
Initialize the Atomiq SDK with Solana network support:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import {SolanaInitializer} from "@atomiqlabs/chain-solana";
|
|
55
|
+
import {BitcoinNetwork, SwapperFactory, TypedSwapper} from "@atomiqlabs/sdk";
|
|
56
|
+
|
|
57
|
+
// Define chains that you want to support here
|
|
58
|
+
const chains = [SolanaInitializer] as const;
|
|
59
|
+
type SupportedChains = typeof chains;
|
|
60
|
+
|
|
61
|
+
const Factory = new SwapperFactory<SupportedChains>(chains);
|
|
62
|
+
|
|
63
|
+
const swapper: TypedSwapper<SupportedChains> = Factory.newSwapper({
|
|
64
|
+
chains: {
|
|
65
|
+
SOLANA: {
|
|
66
|
+
rpcUrl: solanaRpc // You can also pass a web3.js Connection object here
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
bitcoinNetwork: BitcoinNetwork.MAINNET // or BitcoinNetwork.TESTNET
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If you use the lower-level initializer directly, you can also provide a custom storage backend for temporary Solana data accounts used when submitting large Bitcoin proof payloads.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # @atomiqlabs/chain-solana
|
|
3
|
+
*
|
|
4
|
+
* `@atomiqlabs/chain-solana` is the Solana integration package for the Atomiq protocol.
|
|
5
|
+
*
|
|
6
|
+
* Within the Atomiq stack, this library provides the Solana-side building blocks used for Bitcoin-aware swaps on Solana. It includes:
|
|
7
|
+
*
|
|
8
|
+
* - the `SolanaInitializer` used to register Solana support in the Atomiq SDK
|
|
9
|
+
* - the `SolanaChainInterface` used to talk to Solana RPCs
|
|
10
|
+
* - Solana BTC relay and swap program wrappers
|
|
11
|
+
* - signer and wallet helpers for Solana integrations
|
|
12
|
+
* - connection retry and chain event utilities
|
|
13
|
+
*
|
|
14
|
+
* This package is intended for direct protocol integrations and for higher-level Atomiq SDK layers that need Solana chain support.
|
|
15
|
+
*
|
|
16
|
+
* ## Installation
|
|
17
|
+
*
|
|
18
|
+
* Install the package with its `@solana/web3.js` peer dependency:
|
|
19
|
+
*
|
|
20
|
+
* ```bash
|
|
21
|
+
* npm install @atomiqlabs/chain-solana @solana/web3.js
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ## Supported Chains
|
|
25
|
+
*
|
|
26
|
+
* This package exports a single Solana initializer:
|
|
27
|
+
*
|
|
28
|
+
* - Solana via `SolanaInitializer`
|
|
29
|
+
*
|
|
30
|
+
* Canonical deployments currently defined in this package:
|
|
31
|
+
*
|
|
32
|
+
* | Chain | Canonical deployments included |
|
|
33
|
+
* | --- | --- |
|
|
34
|
+
* | Solana | `MAINNET`, `TESTNET` |
|
|
35
|
+
*
|
|
36
|
+
* In this package, the selected Bitcoin network determines which canonical Solana program addresses are used by default. `BitcoinNetwork.TESTNET4` is not wired to a Solana deployment here yet.
|
|
37
|
+
*
|
|
38
|
+
* The Solana implementation doesn't support the UTXO-controlled vault (SPV vault) contract, hence it can only process legacy HTLC & PrTLC based swaps.
|
|
39
|
+
*
|
|
40
|
+
* ## SDK Example
|
|
41
|
+
*
|
|
42
|
+
* Initialize the Atomiq SDK with Solana network support:
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* import {SolanaInitializer} from "@atomiqlabs/chain-solana";
|
|
46
|
+
* import {BitcoinNetwork, SwapperFactory, TypedSwapper} from "@atomiqlabs/sdk";
|
|
47
|
+
*
|
|
48
|
+
* // Define chains that you want to support here
|
|
49
|
+
* const chains = [SolanaInitializer] as const;
|
|
50
|
+
* type SupportedChains = typeof chains;
|
|
51
|
+
*
|
|
52
|
+
* const Factory = new SwapperFactory<SupportedChains>(chains);
|
|
53
|
+
*
|
|
54
|
+
* const swapper: TypedSwapper<SupportedChains> = Factory.newSwapper({
|
|
55
|
+
* chains: {
|
|
56
|
+
* SOLANA: {
|
|
57
|
+
* rpcUrl: solanaRpc // You can also pass a web3.js Connection object here
|
|
58
|
+
* }
|
|
59
|
+
* },
|
|
60
|
+
* bitcoinNetwork: BitcoinNetwork.MAINNET // or BitcoinNetwork.TESTNET
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* If you use the lower-level initializer directly, you can also provide a custom storage backend for temporary Solana data accounts used when submitting large Bitcoin proof payloads.
|
|
65
|
+
*
|
|
66
|
+
* @packageDocumentation
|
|
67
|
+
*/
|
|
1
68
|
export { SolanaBtcHeader } from "./solana/btcrelay/headers/SolanaBtcHeader";
|
|
2
69
|
export { SolanaBtcStoredHeader } from "./solana/btcrelay/headers/SolanaBtcStoredHeader";
|
|
3
70
|
export * from "./solana/btcrelay/SolanaBtcRelay";
|
|
4
71
|
export * from "./solana/chain/SolanaChainInterface";
|
|
5
72
|
export * from "./solana/chain/modules/SolanaFees";
|
|
6
|
-
export
|
|
73
|
+
export { SolanaTx, SignedSolanaTx } from "./solana/chain/modules/SolanaTransactions";
|
|
74
|
+
export { ConnectionWithRetries } from "./solana/connection/ConnectionWithRetries";
|
|
75
|
+
export { SolanaChainEventsBrowser, SolanaEventListenerState } from "./solana/events/SolanaChainEventsBrowser";
|
|
7
76
|
export * from "./solana/swaps/SolanaSwapProgram";
|
|
8
77
|
export { SolanaSwapData } from "./solana/swaps/SolanaSwapData";
|
|
9
78
|
export * from "./solana/wallet/SolanaKeypairWallet";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,74 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.SolanaSwapData = exports.SolanaBtcStoredHeader = exports.SolanaBtcHeader = void 0;
|
|
17
|
+
exports.SolanaSwapData = exports.SolanaChainEventsBrowser = exports.ConnectionWithRetries = exports.SolanaBtcStoredHeader = exports.SolanaBtcHeader = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* # @atomiqlabs/chain-solana
|
|
20
|
+
*
|
|
21
|
+
* `@atomiqlabs/chain-solana` is the Solana integration package for the Atomiq protocol.
|
|
22
|
+
*
|
|
23
|
+
* Within the Atomiq stack, this library provides the Solana-side building blocks used for Bitcoin-aware swaps on Solana. It includes:
|
|
24
|
+
*
|
|
25
|
+
* - the `SolanaInitializer` used to register Solana support in the Atomiq SDK
|
|
26
|
+
* - the `SolanaChainInterface` used to talk to Solana RPCs
|
|
27
|
+
* - Solana BTC relay and swap program wrappers
|
|
28
|
+
* - signer and wallet helpers for Solana integrations
|
|
29
|
+
* - connection retry and chain event utilities
|
|
30
|
+
*
|
|
31
|
+
* This package is intended for direct protocol integrations and for higher-level Atomiq SDK layers that need Solana chain support.
|
|
32
|
+
*
|
|
33
|
+
* ## Installation
|
|
34
|
+
*
|
|
35
|
+
* Install the package with its `@solana/web3.js` peer dependency:
|
|
36
|
+
*
|
|
37
|
+
* ```bash
|
|
38
|
+
* npm install @atomiqlabs/chain-solana @solana/web3.js
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ## Supported Chains
|
|
42
|
+
*
|
|
43
|
+
* This package exports a single Solana initializer:
|
|
44
|
+
*
|
|
45
|
+
* - Solana via `SolanaInitializer`
|
|
46
|
+
*
|
|
47
|
+
* Canonical deployments currently defined in this package:
|
|
48
|
+
*
|
|
49
|
+
* | Chain | Canonical deployments included |
|
|
50
|
+
* | --- | --- |
|
|
51
|
+
* | Solana | `MAINNET`, `TESTNET` |
|
|
52
|
+
*
|
|
53
|
+
* In this package, the selected Bitcoin network determines which canonical Solana program addresses are used by default. `BitcoinNetwork.TESTNET4` is not wired to a Solana deployment here yet.
|
|
54
|
+
*
|
|
55
|
+
* The Solana implementation doesn't support the UTXO-controlled vault (SPV vault) contract, hence it can only process legacy HTLC & PrTLC based swaps.
|
|
56
|
+
*
|
|
57
|
+
* ## SDK Example
|
|
58
|
+
*
|
|
59
|
+
* Initialize the Atomiq SDK with Solana network support:
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* import {SolanaInitializer} from "@atomiqlabs/chain-solana";
|
|
63
|
+
* import {BitcoinNetwork, SwapperFactory, TypedSwapper} from "@atomiqlabs/sdk";
|
|
64
|
+
*
|
|
65
|
+
* // Define chains that you want to support here
|
|
66
|
+
* const chains = [SolanaInitializer] as const;
|
|
67
|
+
* type SupportedChains = typeof chains;
|
|
68
|
+
*
|
|
69
|
+
* const Factory = new SwapperFactory<SupportedChains>(chains);
|
|
70
|
+
*
|
|
71
|
+
* const swapper: TypedSwapper<SupportedChains> = Factory.newSwapper({
|
|
72
|
+
* chains: {
|
|
73
|
+
* SOLANA: {
|
|
74
|
+
* rpcUrl: solanaRpc // You can also pass a web3.js Connection object here
|
|
75
|
+
* }
|
|
76
|
+
* },
|
|
77
|
+
* bitcoinNetwork: BitcoinNetwork.MAINNET // or BitcoinNetwork.TESTNET
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* If you use the lower-level initializer directly, you can also provide a custom storage backend for temporary Solana data accounts used when submitting large Bitcoin proof payloads.
|
|
82
|
+
*
|
|
83
|
+
* @packageDocumentation
|
|
84
|
+
*/
|
|
18
85
|
var SolanaBtcHeader_1 = require("./solana/btcrelay/headers/SolanaBtcHeader");
|
|
19
86
|
Object.defineProperty(exports, "SolanaBtcHeader", { enumerable: true, get: function () { return SolanaBtcHeader_1.SolanaBtcHeader; } });
|
|
20
87
|
var SolanaBtcStoredHeader_1 = require("./solana/btcrelay/headers/SolanaBtcStoredHeader");
|
|
@@ -22,7 +89,10 @@ Object.defineProperty(exports, "SolanaBtcStoredHeader", { enumerable: true, get:
|
|
|
22
89
|
__exportStar(require("./solana/btcrelay/SolanaBtcRelay"), exports);
|
|
23
90
|
__exportStar(require("./solana/chain/SolanaChainInterface"), exports);
|
|
24
91
|
__exportStar(require("./solana/chain/modules/SolanaFees"), exports);
|
|
25
|
-
|
|
92
|
+
var ConnectionWithRetries_1 = require("./solana/connection/ConnectionWithRetries");
|
|
93
|
+
Object.defineProperty(exports, "ConnectionWithRetries", { enumerable: true, get: function () { return ConnectionWithRetries_1.ConnectionWithRetries; } });
|
|
94
|
+
var SolanaChainEventsBrowser_1 = require("./solana/events/SolanaChainEventsBrowser");
|
|
95
|
+
Object.defineProperty(exports, "SolanaChainEventsBrowser", { enumerable: true, get: function () { return SolanaChainEventsBrowser_1.SolanaChainEventsBrowser; } });
|
|
26
96
|
__exportStar(require("./solana/swaps/SolanaSwapProgram"), exports);
|
|
27
97
|
var SolanaSwapData_1 = require("./solana/swaps/SolanaSwapData");
|
|
28
98
|
Object.defineProperty(exports, "SolanaSwapData", { enumerable: true, get: function () { return SolanaSwapData_1.SolanaSwapData; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js-only entrypoint for filesystem-backed Solana helpers.
|
|
3
|
+
*
|
|
4
|
+
* Import from `@atomiqlabs/chain-solana/node` when you need runtime features
|
|
5
|
+
* that depend on Node's `fs` module.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { SolanaChainEvents } from "../solana/events/SolanaChainEvents";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaChainEvents = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Node.js-only entrypoint for filesystem-backed Solana helpers.
|
|
6
|
+
*
|
|
7
|
+
* Import from `@atomiqlabs/chain-solana/node` when you need runtime features
|
|
8
|
+
* that depend on Node's `fs` module.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
var SolanaChainEvents_1 = require("../solana/events/SolanaChainEvents");
|
|
13
|
+
Object.defineProperty(exports, "SolanaChainEvents", { enumerable: true, get: function () { return SolanaChainEvents_1.SolanaChainEvents; } });
|
|
@@ -14,25 +14,55 @@ export type SolanaAssetsType = BaseTokenType<"WBTC" | "USDC" | "USDT" | "SOL" |
|
|
|
14
14
|
* @category Chain Interface
|
|
15
15
|
*/
|
|
16
16
|
export type SolanaSwapperOptions = {
|
|
17
|
+
/**
|
|
18
|
+
* RPC url or {@link Connection} object to use for Solana network access
|
|
19
|
+
*/
|
|
17
20
|
rpcUrl: string | Connection;
|
|
21
|
+
/**
|
|
22
|
+
* Storage backend to use for storing ephemeral data submission accounts, i.e. accounts that are used
|
|
23
|
+
* to submit large amount of data to an instruction that would otherwise be bigger than the transaction
|
|
24
|
+
* size limit - used for submitting bitcoin transaction proofs for PrTLC swaps
|
|
25
|
+
*/
|
|
18
26
|
dataAccountStorage?: IStorageManager<StoredDataAccount>;
|
|
27
|
+
/**
|
|
28
|
+
* Retry policy to be used for Solana RPC calls and transaction submission
|
|
29
|
+
*/
|
|
19
30
|
retryPolicy?: SolanaRetryPolicy;
|
|
31
|
+
/**
|
|
32
|
+
* Optional Solana program address of the BTC Relay contract, uses the canonical deployment by default
|
|
33
|
+
*/
|
|
20
34
|
btcRelayContract?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional Solana program address of the Swap contract, uses the canonical deployment by default
|
|
37
|
+
*/
|
|
21
38
|
swapContract?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Solana fee API to use for fetching Solana network fees
|
|
41
|
+
*/
|
|
22
42
|
fees?: SolanaFees;
|
|
23
43
|
};
|
|
24
44
|
/**
|
|
25
45
|
* Initialize Solana chain integration
|
|
46
|
+
*
|
|
47
|
+
* @param options Options for initializing the Solana chain
|
|
48
|
+
* @param bitcoinRpc Bitcoin RPC to use for bitcoin read access
|
|
49
|
+
* @param network Bitcoin network to use - determines Solana program addresses to use by default
|
|
50
|
+
* @param storageCtor Storage constructor used to create storage backend for ephemeral data submission accounts,
|
|
51
|
+
* i.e. accounts that are used to submit large amount of data to an instruction that would otherwise be bigger
|
|
52
|
+
* than the transaction size limit - used for submitting bitcoin transaction proofs for PrTLC swaps
|
|
53
|
+
*
|
|
26
54
|
* @category Chain Interface
|
|
27
55
|
*/
|
|
28
56
|
export declare function initializeSolana(options: SolanaSwapperOptions, bitcoinRpc: BitcoinRpc<any>, network: BitcoinNetwork, storageCtor: <T extends StorageObject>(name: string) => IStorageManager<T>): ChainData<SolanaChainType>;
|
|
29
57
|
/**
|
|
30
58
|
* Type definition for the Solana chain initializer
|
|
59
|
+
*
|
|
31
60
|
* @category Chain Interface
|
|
32
61
|
*/
|
|
33
62
|
export type SolanaInitializerType = ChainInitializer<SolanaSwapperOptions, SolanaChainType, SolanaAssetsType>;
|
|
34
63
|
/**
|
|
35
|
-
* Solana chain initializer instance
|
|
64
|
+
* Solana chain initializer instance, used in the SwapperFactory constructor in the SDK library
|
|
65
|
+
*
|
|
36
66
|
* @category Chain Interface
|
|
37
67
|
*/
|
|
38
68
|
export declare const SolanaInitializer: SolanaInitializerType;
|
|
@@ -35,6 +35,14 @@ const SolanaAssets = {
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* Initialize Solana chain integration
|
|
38
|
+
*
|
|
39
|
+
* @param options Options for initializing the Solana chain
|
|
40
|
+
* @param bitcoinRpc Bitcoin RPC to use for bitcoin read access
|
|
41
|
+
* @param network Bitcoin network to use - determines Solana program addresses to use by default
|
|
42
|
+
* @param storageCtor Storage constructor used to create storage backend for ephemeral data submission accounts,
|
|
43
|
+
* i.e. accounts that are used to submit large amount of data to an instruction that would otherwise be bigger
|
|
44
|
+
* than the transaction size limit - used for submitting bitcoin transaction proofs for PrTLC swaps
|
|
45
|
+
*
|
|
38
46
|
* @category Chain Interface
|
|
39
47
|
*/
|
|
40
48
|
function initializeSolana(options, bitcoinRpc, network, storageCtor) {
|
|
@@ -63,7 +71,8 @@ function initializeSolana(options, bitcoinRpc, network, storageCtor) {
|
|
|
63
71
|
}
|
|
64
72
|
exports.initializeSolana = initializeSolana;
|
|
65
73
|
/**
|
|
66
|
-
* Solana chain initializer instance
|
|
74
|
+
* Solana chain initializer instance, used in the SwapperFactory constructor in the SDK library
|
|
75
|
+
*
|
|
67
76
|
* @category Chain Interface
|
|
68
77
|
*/
|
|
69
78
|
exports.SolanaInitializer = {
|
|
@@ -9,6 +9,8 @@ import { Buffer } from "buffer";
|
|
|
9
9
|
import { SolanaSigner } from "../wallet/SolanaSigner";
|
|
10
10
|
import { SolanaChainInterface } from "../chain/SolanaChainInterface";
|
|
11
11
|
/**
|
|
12
|
+
* Solana BTC relay (bitcoin light client) program representation.
|
|
13
|
+
*
|
|
12
14
|
* @category BTC Relay
|
|
13
15
|
*/
|
|
14
16
|
export declare class SolanaBtcRelay<B extends BtcBlock> extends SolanaProgramBase<any> implements BtcRelay<SolanaBtcStoredHeader, {
|
|
@@ -38,14 +40,48 @@ export declare class SolanaBtcRelay<B extends BtcBlock> extends SolanaProgramBas
|
|
|
38
40
|
* @param committedHeader
|
|
39
41
|
*/
|
|
40
42
|
Verify(signer: PublicKey, reversedTxId: Buffer, confirmations: number, position: number, reversedMerkleProof: Buffer[], committedHeader: SolanaBtcStoredHeader): Promise<SolanaAction>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Creates an action that closes a fork account and refunds rent to the signer.
|
|
45
|
+
*
|
|
46
|
+
* @param signer Signer paying and receiving rent refund
|
|
47
|
+
* @param forkId Fork account identifier to close
|
|
48
|
+
*/
|
|
49
|
+
private CloseForkAccount;
|
|
50
|
+
/**
|
|
51
|
+
* PDA of the relay main state account.
|
|
52
|
+
*/
|
|
53
|
+
private readonly BtcRelayMainState;
|
|
54
|
+
/**
|
|
55
|
+
* PDA helper for per-header topic accounts.
|
|
56
|
+
*/
|
|
57
|
+
private readonly BtcRelayHeader;
|
|
58
|
+
/**
|
|
59
|
+
* PDA helper for fork state accounts.
|
|
60
|
+
*/
|
|
61
|
+
private readonly BtcRelayFork;
|
|
62
|
+
/**
|
|
63
|
+
* Bitcoin RPC client used for bitcoin chain lookups.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
_bitcoinRpc: BitcoinRpc<B>;
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
46
71
|
readonly maxHeadersPerTx: number;
|
|
72
|
+
/**
|
|
73
|
+
* @inheritDoc
|
|
74
|
+
*/
|
|
47
75
|
readonly maxForkHeadersPerTx: number;
|
|
76
|
+
/**
|
|
77
|
+
* @inheritDoc
|
|
78
|
+
*/
|
|
48
79
|
readonly maxShortForkHeadersPerTx: number;
|
|
80
|
+
/**
|
|
81
|
+
* @param chainInterface Underlying chain interface to use for the Solana chain operations
|
|
82
|
+
* @param bitcoinRpc Bitcoin RPC instance to use for read access to the bitcoin blockchain
|
|
83
|
+
* @param programAddress Optional Solana on-chain program address, defaults to the cannonical deployment
|
|
84
|
+
*/
|
|
49
85
|
constructor(chainInterface: SolanaChainInterface, bitcoinRpc: BitcoinRpc<B>, programAddress?: string);
|
|
50
86
|
/**
|
|
51
87
|
* Gets set of block commitments representing current main chain from the mainState
|
|
@@ -55,7 +91,7 @@ export declare class SolanaBtcRelay<B extends BtcBlock> extends SolanaProgramBas
|
|
|
55
91
|
*/
|
|
56
92
|
private getBlockCommitmentsSet;
|
|
57
93
|
/**
|
|
58
|
-
* Computes subsequent
|
|
94
|
+
* Computes subsequent committed headers as they will appear on the blockchain when transactions
|
|
59
95
|
* are submitted & confirmed
|
|
60
96
|
*
|
|
61
97
|
* @param initialStoredHeader
|
|
@@ -10,6 +10,7 @@ const SolanaProgramBase_1 = require("../program/SolanaProgramBase");
|
|
|
10
10
|
const SolanaAction_1 = require("../chain/SolanaAction");
|
|
11
11
|
const buffer_1 = require("buffer");
|
|
12
12
|
const BN = require("bn.js");
|
|
13
|
+
const SolanaFees_1 = require("../chain/modules/SolanaFees");
|
|
13
14
|
const MAX_CLOSE_IX_PER_TX = 10;
|
|
14
15
|
function serializeBlockHeader(e) {
|
|
15
16
|
return new SolanaBtcHeader_1.SolanaBtcHeader({
|
|
@@ -24,6 +25,8 @@ function serializeBlockHeader(e) {
|
|
|
24
25
|
}
|
|
25
26
|
;
|
|
26
27
|
/**
|
|
28
|
+
* Solana BTC relay (bitcoin light client) program representation.
|
|
29
|
+
*
|
|
27
30
|
* @category BTC Relay
|
|
28
31
|
*/
|
|
29
32
|
class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
@@ -38,12 +41,12 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
38
41
|
*/
|
|
39
42
|
async Initialize(signer, header, epochStart, pastBlocksTimestamps) {
|
|
40
43
|
const serializedBlock = serializeBlockHeader(header);
|
|
41
|
-
return new SolanaAction_1.SolanaAction(signer, this.
|
|
44
|
+
return new SolanaAction_1.SolanaAction(signer, this._Chain, await this.program.methods
|
|
42
45
|
.initialize(serializedBlock, header.getHeight(), header.getChainWork(), epochStart, pastBlocksTimestamps)
|
|
43
46
|
.accounts({
|
|
44
47
|
signer,
|
|
45
48
|
mainState: this.BtcRelayMainState,
|
|
46
|
-
headerTopic: this.BtcRelayHeader(serializedBlock.
|
|
49
|
+
headerTopic: this.BtcRelayHeader(serializedBlock.getHash()),
|
|
47
50
|
systemProgram: web3_js_1.SystemProgram.programId
|
|
48
51
|
})
|
|
49
52
|
.instruction(), 100000);
|
|
@@ -61,7 +64,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
61
64
|
* @param committedHeader
|
|
62
65
|
*/
|
|
63
66
|
async Verify(signer, reversedTxId, confirmations, position, reversedMerkleProof, committedHeader) {
|
|
64
|
-
return new SolanaAction_1.SolanaAction(signer, this.
|
|
67
|
+
return new SolanaAction_1.SolanaAction(signer, this._Chain, await this.program.methods
|
|
65
68
|
.verifyTransaction(reversedTxId, confirmations, position, reversedMerkleProof, committedHeader)
|
|
66
69
|
.accounts({
|
|
67
70
|
signer,
|
|
@@ -69,8 +72,14 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
69
72
|
})
|
|
70
73
|
.instruction(), undefined, undefined, undefined, true);
|
|
71
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates an action that closes a fork account and refunds rent to the signer.
|
|
77
|
+
*
|
|
78
|
+
* @param signer Signer paying and receiving rent refund
|
|
79
|
+
* @param forkId Fork account identifier to close
|
|
80
|
+
*/
|
|
72
81
|
async CloseForkAccount(signer, forkId) {
|
|
73
|
-
return new SolanaAction_1.SolanaAction(signer, this.
|
|
82
|
+
return new SolanaAction_1.SolanaAction(signer, this._Chain, await this.program.methods
|
|
74
83
|
.closeForkAccount(new BN(forkId))
|
|
75
84
|
.accounts({
|
|
76
85
|
signer,
|
|
@@ -79,15 +88,38 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
79
88
|
})
|
|
80
89
|
.instruction(), 20000);
|
|
81
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @param chainInterface Underlying chain interface to use for the Solana chain operations
|
|
93
|
+
* @param bitcoinRpc Bitcoin RPC instance to use for read access to the bitcoin blockchain
|
|
94
|
+
* @param programAddress Optional Solana on-chain program address, defaults to the cannonical deployment
|
|
95
|
+
*/
|
|
82
96
|
constructor(chainInterface, bitcoinRpc, programAddress) {
|
|
83
97
|
super(chainInterface, programIdl, programAddress);
|
|
98
|
+
/**
|
|
99
|
+
* PDA of the relay main state account.
|
|
100
|
+
*/
|
|
84
101
|
this.BtcRelayMainState = this.pda("state");
|
|
102
|
+
/**
|
|
103
|
+
* PDA helper for per-header topic accounts.
|
|
104
|
+
*/
|
|
85
105
|
this.BtcRelayHeader = this.pda("header", (hash) => [hash]);
|
|
106
|
+
/**
|
|
107
|
+
* PDA helper for fork state accounts.
|
|
108
|
+
*/
|
|
86
109
|
this.BtcRelayFork = this.pda("fork", (forkId, pubkey) => [new BN(forkId).toArrayLike(buffer_1.Buffer, "le", 8), pubkey.toBuffer()]);
|
|
110
|
+
/**
|
|
111
|
+
* @inheritDoc
|
|
112
|
+
*/
|
|
87
113
|
this.maxHeadersPerTx = 5;
|
|
114
|
+
/**
|
|
115
|
+
* @inheritDoc
|
|
116
|
+
*/
|
|
88
117
|
this.maxForkHeadersPerTx = 4;
|
|
118
|
+
/**
|
|
119
|
+
* @inheritDoc
|
|
120
|
+
*/
|
|
89
121
|
this.maxShortForkHeadersPerTx = 4;
|
|
90
|
-
this.
|
|
122
|
+
this._bitcoinRpc = bitcoinRpc;
|
|
91
123
|
}
|
|
92
124
|
/**
|
|
93
125
|
* Gets set of block commitments representing current main chain from the mainState
|
|
@@ -103,7 +135,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
103
135
|
return storedCommitments;
|
|
104
136
|
}
|
|
105
137
|
/**
|
|
106
|
-
* Computes subsequent
|
|
138
|
+
* Computes subsequent committed headers as they will appear on the blockchain when transactions
|
|
107
139
|
* are submitted & confirmed
|
|
108
140
|
*
|
|
109
141
|
* @param initialStoredHeader
|
|
@@ -133,15 +165,15 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
133
165
|
const tx = await createTx(blockHeaderObj)
|
|
134
166
|
.remainingAccounts(blockHeaderObj.map(e => {
|
|
135
167
|
return {
|
|
136
|
-
pubkey: this.BtcRelayHeader(e.
|
|
168
|
+
pubkey: this.BtcRelayHeader(e.getHash()),
|
|
137
169
|
isSigner: false,
|
|
138
170
|
isWritable: false
|
|
139
171
|
};
|
|
140
172
|
}))
|
|
141
173
|
.transaction();
|
|
142
174
|
tx.feePayer = signer;
|
|
143
|
-
|
|
144
|
-
|
|
175
|
+
SolanaFees_1.SolanaFees.applyFeeRateBegin(tx, null, feeRate);
|
|
176
|
+
SolanaFees_1.SolanaFees.applyFeeRateEnd(tx, null, feeRate);
|
|
145
177
|
const computedCommitedHeaders = this.computeCommitedHeaders(storedHeader, blockHeaderObj);
|
|
146
178
|
const lastStoredHeader = computedCommitedHeaders[computedCommitedHeaders.length - 1];
|
|
147
179
|
return {
|
|
@@ -179,7 +211,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
179
211
|
const storedCommitments = this.getBlockCommitmentsSet(mainState);
|
|
180
212
|
const blockHashBuffer = buffer_1.Buffer.from(blockData.blockhash, 'hex').reverse();
|
|
181
213
|
const topicKey = this.BtcRelayHeader(blockHashBuffer);
|
|
182
|
-
const data = await this.
|
|
214
|
+
const data = await this._Events.findInEvents(topicKey, async (event) => {
|
|
183
215
|
if (event.name === "StoreFork" || event.name === "StoreHeader") {
|
|
184
216
|
const eventData = event.data;
|
|
185
217
|
const commitHash = buffer_1.Buffer.from(eventData.commitHash).toString("hex");
|
|
@@ -202,7 +234,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
202
234
|
async retrieveLogByCommitHash(commitmentHashStr, blockData) {
|
|
203
235
|
const blockHashBuffer = buffer_1.Buffer.from(blockData.blockhash, "hex").reverse();
|
|
204
236
|
const topicKey = this.BtcRelayHeader(blockHashBuffer);
|
|
205
|
-
const data = await this.
|
|
237
|
+
const data = await this._Events.findInEvents(topicKey, async (event) => {
|
|
206
238
|
if (event.name === "StoreFork" || event.name === "StoreHeader") {
|
|
207
239
|
const eventData = event.data;
|
|
208
240
|
const commitHash = buffer_1.Buffer.from(eventData.commitHash).toString("hex");
|
|
@@ -212,7 +244,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
212
244
|
});
|
|
213
245
|
if (data != null)
|
|
214
246
|
this.logger.debug("retrieveLogByCommitHash(): block found," +
|
|
215
|
-
" commit hash: " + commitmentHashStr + " blockhash: " + blockData.blockhash + " height: " + data.
|
|
247
|
+
" commit hash: " + commitmentHashStr + " blockhash: " + blockData.blockhash + " height: " + data.getBlockheight());
|
|
216
248
|
return data;
|
|
217
249
|
}
|
|
218
250
|
/**
|
|
@@ -221,15 +253,15 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
221
253
|
async retrieveLatestKnownBlockLog() {
|
|
222
254
|
const mainState = await this.program.account.mainState.fetch(this.BtcRelayMainState);
|
|
223
255
|
const storedCommitments = this.getBlockCommitmentsSet(mainState);
|
|
224
|
-
const data = await this.
|
|
256
|
+
const data = await this._Events.findInEvents(this.program.programId, async (event) => {
|
|
225
257
|
if (event.name === "StoreFork" || event.name === "StoreHeader") {
|
|
226
258
|
const eventData = event.data;
|
|
227
259
|
const blockHashHex = buffer_1.Buffer.from(eventData.blockHash).reverse().toString("hex");
|
|
228
|
-
const isInMainChain = await this.
|
|
260
|
+
const isInMainChain = await this._bitcoinRpc.isInMainChain(blockHashHex).catch(() => false);
|
|
229
261
|
const commitHash = buffer_1.Buffer.from(eventData.commitHash).toString("hex");
|
|
230
262
|
//Check if this fork is part of main chain
|
|
231
263
|
if (isInMainChain && storedCommitments.has(commitHash)) {
|
|
232
|
-
const blockHeader = await this.
|
|
264
|
+
const blockHeader = await this._bitcoinRpc.getBlockHeader(blockHashHex);
|
|
233
265
|
if (blockHeader == null)
|
|
234
266
|
return null;
|
|
235
267
|
return {
|
|
@@ -243,7 +275,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
243
275
|
if (data != null)
|
|
244
276
|
this.logger.debug("retrieveLatestKnownBlockLog(): block found," +
|
|
245
277
|
" commit hash: " + data.commitHash + " blockhash: " + data.resultBitcoinHeader.getHash() +
|
|
246
|
-
" height: " + data.resultStoredHeader.
|
|
278
|
+
" height: " + data.resultStoredHeader.getBlockheight());
|
|
247
279
|
return data;
|
|
248
280
|
}
|
|
249
281
|
/**
|
|
@@ -289,7 +321,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
289
321
|
forkState: this.BtcRelayFork(forkId.toNumber(), _signer),
|
|
290
322
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
291
323
|
}));
|
|
292
|
-
if (result.forkId !== 0 && base_1.StatePredictorUtils.gtBuffer(
|
|
324
|
+
if (result.forkId !== 0 && base_1.StatePredictorUtils.gtBuffer(result.lastStoredHeader.getChainWork(), tipWork)) {
|
|
293
325
|
//Fork's work is higher than main chain's work, this fork will become a main chain
|
|
294
326
|
result.forkId = 0;
|
|
295
327
|
}
|
|
@@ -311,7 +343,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
311
343
|
forkState: this.BtcRelayFork(forkId, _signer),
|
|
312
344
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
313
345
|
}));
|
|
314
|
-
if (result.forkId !== 0 && base_1.StatePredictorUtils.gtBuffer(
|
|
346
|
+
if (result.forkId !== 0 && base_1.StatePredictorUtils.gtBuffer(result.lastStoredHeader.getChainWork(), tipWork)) {
|
|
315
347
|
//Fork's work is higher than main chain's work, this fork will become a main chain
|
|
316
348
|
result.forkId = 0;
|
|
317
349
|
}
|
|
@@ -331,7 +363,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
331
363
|
signer: _signer,
|
|
332
364
|
mainState: this.BtcRelayMainState
|
|
333
365
|
}));
|
|
334
|
-
if (result.forkId !== 0 && base_1.StatePredictorUtils.gtBuffer(
|
|
366
|
+
if (result.forkId !== 0 && base_1.StatePredictorUtils.gtBuffer(result.lastStoredHeader.getChainWork(), tipWork)) {
|
|
335
367
|
//Fork's work is higher than main chain's work, this fork will become a main chain
|
|
336
368
|
result.forkId = 0;
|
|
337
369
|
}
|
|
@@ -344,7 +376,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
344
376
|
const mainState = await this.program.account.mainState.fetch(this.BtcRelayMainState);
|
|
345
377
|
let forkId = mainState.forkCounter.toNumber();
|
|
346
378
|
const txs = [];
|
|
347
|
-
let action = new SolanaAction_1.SolanaAction(signer.getPublicKey(), this.
|
|
379
|
+
let action = new SolanaAction_1.SolanaAction(signer.getPublicKey(), this._Chain);
|
|
348
380
|
let lastCheckedId = lastSweepId;
|
|
349
381
|
for (let i = lastSweepId == null ? 0 : lastSweepId + 1; i <= forkId; i++) {
|
|
350
382
|
lastCheckedId = i;
|
|
@@ -356,14 +388,14 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
356
388
|
action.add(await this.CloseForkAccount(signer.getPublicKey(), i));
|
|
357
389
|
if (action.ixsLength() >= MAX_CLOSE_IX_PER_TX) {
|
|
358
390
|
await action.addToTxs(txs);
|
|
359
|
-
action = new SolanaAction_1.SolanaAction(signer.getPublicKey(), this.
|
|
391
|
+
action = new SolanaAction_1.SolanaAction(signer.getPublicKey(), this._Chain);
|
|
360
392
|
}
|
|
361
393
|
}
|
|
362
394
|
if (action.ixsLength() >= MAX_CLOSE_IX_PER_TX) {
|
|
363
395
|
await action.addToTxs(txs);
|
|
364
396
|
}
|
|
365
397
|
if (txs.length > 0) {
|
|
366
|
-
const signatures = await this.
|
|
398
|
+
const signatures = await this._Chain.sendAndConfirm(signer, txs, true);
|
|
367
399
|
this.logger.info("sweepForkData(): forks swept, signatures: " + signatures.join());
|
|
368
400
|
}
|
|
369
401
|
return lastCheckedId ?? null;
|
|
@@ -397,7 +429,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
397
429
|
*/
|
|
398
430
|
getMainFeeRate(signer) {
|
|
399
431
|
const _signer = signer == null ? null : new web3_js_1.PublicKey(signer);
|
|
400
|
-
return this.
|
|
432
|
+
return this._Chain.Fees.getFeeRate(_signer == null ? [this.BtcRelayMainState] : [
|
|
401
433
|
_signer,
|
|
402
434
|
this.BtcRelayMainState
|
|
403
435
|
]);
|
|
@@ -407,7 +439,7 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
407
439
|
*/
|
|
408
440
|
getForkFeeRate(signer, forkId) {
|
|
409
441
|
const _signer = new web3_js_1.PublicKey(signer);
|
|
410
|
-
return this.
|
|
442
|
+
return this._Chain.Fees.getFeeRate([
|
|
411
443
|
_signer,
|
|
412
444
|
this.BtcRelayMainState,
|
|
413
445
|
this.BtcRelayFork(forkId, _signer)
|