@getomnichain/omnichain 0.2.0
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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/abstract_gas_pricing.d.ts +31 -0
- package/dist/abstract_gas_pricing.d.ts.map +1 -0
- package/dist/abstract_gas_pricing.js +22 -0
- package/dist/abstract_gas_pricing.js.map +1 -0
- package/dist/address.d.ts +10 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.factory.d.ts +26 -0
- package/dist/address.factory.d.ts.map +1 -0
- package/dist/address.factory.js +75 -0
- package/dist/address.factory.js.map +1 -0
- package/dist/address.js +13 -0
- package/dist/address.js.map +1 -0
- package/dist/address_field.decorator.d.ts +17 -0
- package/dist/address_field.decorator.d.ts.map +1 -0
- package/dist/address_field.decorator.js +34 -0
- package/dist/address_field.decorator.js.map +1 -0
- package/dist/chain.base.d.ts +79 -0
- package/dist/chain.base.d.ts.map +1 -0
- package/dist/chain.base.js +113 -0
- package/dist/chain.base.js.map +1 -0
- package/dist/chain_ids.d.ts +122 -0
- package/dist/chain_ids.d.ts.map +1 -0
- package/dist/chain_ids.js +193 -0
- package/dist/chain_ids.js.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +62 -0
- package/dist/errors.js.map +1 -0
- package/dist/evm/evm_address.d.ts +11 -0
- package/dist/evm/evm_address.d.ts.map +1 -0
- package/dist/evm/evm_address.js +56 -0
- package/dist/evm/evm_address.js.map +1 -0
- package/dist/evm/evm_chain.d.ts +123 -0
- package/dist/evm/evm_chain.d.ts.map +1 -0
- package/dist/evm/evm_chain.js +685 -0
- package/dist/evm/evm_chain.js.map +1 -0
- package/dist/evm/evm_chains.d.ts +83 -0
- package/dist/evm/evm_chains.d.ts.map +1 -0
- package/dist/evm/evm_chains.js +493 -0
- package/dist/evm/evm_chains.js.map +1 -0
- package/dist/evm/evm_gas_estimate.d.ts +45 -0
- package/dist/evm/evm_gas_estimate.d.ts.map +1 -0
- package/dist/evm/evm_gas_estimate.js +70 -0
- package/dist/evm/evm_gas_estimate.js.map +1 -0
- package/dist/evm/evm_gas_pricing.d.ts +40 -0
- package/dist/evm/evm_gas_pricing.d.ts.map +1 -0
- package/dist/evm/evm_gas_pricing.js +56 -0
- package/dist/evm/evm_gas_pricing.js.map +1 -0
- package/dist/evm/evm_token.d.ts +7 -0
- package/dist/evm/evm_token.d.ts.map +1 -0
- package/dist/evm/evm_token.js +22 -0
- package/dist/evm/evm_token.js.map +1 -0
- package/dist/evm/evm_tokens.d.ts +81 -0
- package/dist/evm/evm_tokens.d.ts.map +1 -0
- package/dist/evm/evm_tokens.js +104 -0
- package/dist/evm/evm_tokens.js.map +1 -0
- package/dist/evm/evm_transaction_status.d.ts +108 -0
- package/dist/evm/evm_transaction_status.d.ts.map +1 -0
- package/dist/evm/evm_transaction_status.js +177 -0
- package/dist/evm/evm_transaction_status.js.map +1 -0
- package/dist/evm/index.d.ts +10 -0
- package/dist/evm/index.d.ts.map +1 -0
- package/dist/evm/index.js +10 -0
- package/dist/evm/index.js.map +1 -0
- package/dist/evm/unsigned_evm_transaction.d.ts +19 -0
- package/dist/evm/unsigned_evm_transaction.d.ts.map +1 -0
- package/dist/evm/unsigned_evm_transaction.js +18 -0
- package/dist/evm/unsigned_evm_transaction.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/is_address.decorator.d.ts +3 -0
- package/dist/is_address.decorator.d.ts.map +1 -0
- package/dist/is_address.decorator.js +51 -0
- package/dist/is_address.decorator.js.map +1 -0
- package/dist/network_type.d.ts +73 -0
- package/dist/network_type.d.ts.map +1 -0
- package/dist/network_type.js +144 -0
- package/dist/network_type.js.map +1 -0
- package/dist/priority.d.ts +23 -0
- package/dist/priority.d.ts.map +1 -0
- package/dist/priority.js +23 -0
- package/dist/priority.js.map +1 -0
- package/dist/solana/index.d.ts +9 -0
- package/dist/solana/index.d.ts.map +1 -0
- package/dist/solana/index.js +9 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana/solana_address.d.ts +20 -0
- package/dist/solana/solana_address.d.ts.map +1 -0
- package/dist/solana/solana_address.js +45 -0
- package/dist/solana/solana_address.js.map +1 -0
- package/dist/solana/solana_chain.d.ts +213 -0
- package/dist/solana/solana_chain.d.ts.map +1 -0
- package/dist/solana/solana_chain.js +704 -0
- package/dist/solana/solana_chain.js.map +1 -0
- package/dist/solana/solana_chains.d.ts +24 -0
- package/dist/solana/solana_chains.d.ts.map +1 -0
- package/dist/solana/solana_chains.js +84 -0
- package/dist/solana/solana_chains.js.map +1 -0
- package/dist/solana/solana_gas_pricing.d.ts +30 -0
- package/dist/solana/solana_gas_pricing.d.ts.map +1 -0
- package/dist/solana/solana_gas_pricing.js +26 -0
- package/dist/solana/solana_gas_pricing.js.map +1 -0
- package/dist/solana/solana_token.d.ts +19 -0
- package/dist/solana/solana_token.d.ts.map +1 -0
- package/dist/solana/solana_token.js +34 -0
- package/dist/solana/solana_token.js.map +1 -0
- package/dist/solana/solana_tokens.d.ts +22 -0
- package/dist/solana/solana_tokens.d.ts.map +1 -0
- package/dist/solana/solana_tokens.js +26 -0
- package/dist/solana/solana_tokens.js.map +1 -0
- package/dist/solana/solana_transaction_status.d.ts +59 -0
- package/dist/solana/solana_transaction_status.d.ts.map +1 -0
- package/dist/solana/solana_transaction_status.js +144 -0
- package/dist/solana/solana_transaction_status.js.map +1 -0
- package/dist/solana/unsigned_solana_transaction.d.ts +31 -0
- package/dist/solana/unsigned_solana_transaction.d.ts.map +1 -0
- package/dist/solana/unsigned_solana_transaction.js +26 -0
- package/dist/solana/unsigned_solana_transaction.js.map +1 -0
- package/dist/token.d.ts +35 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +62 -0
- package/dist/token.js.map +1 -0
- package/dist/ton/index.d.ts +2 -0
- package/dist/ton/index.d.ts.map +1 -0
- package/dist/ton/index.js +2 -0
- package/dist/ton/index.js.map +1 -0
- package/dist/ton/ton_address.d.ts +10 -0
- package/dist/ton/ton_address.d.ts.map +1 -0
- package/dist/ton/ton_address.js +53 -0
- package/dist/ton/ton_address.js.map +1 -0
- package/dist/transaction_status.d.ts +140 -0
- package/dist/transaction_status.d.ts.map +1 -0
- package/dist/transaction_status.js +271 -0
- package/dist/transaction_status.js.map +1 -0
- package/dist/unsigned_transaction.d.ts +7 -0
- package/dist/unsigned_transaction.d.ts.map +1 -0
- package/dist/unsigned_transaction.js +9 -0
- package/dist/unsigned_transaction.js.map +1 -0
- package/dist/utxo/btc/btc_address.d.ts +15 -0
- package/dist/utxo/btc/btc_address.d.ts.map +1 -0
- package/dist/utxo/btc/btc_address.js +39 -0
- package/dist/utxo/btc/btc_address.js.map +1 -0
- package/dist/utxo/btc/btc_chain.d.ts +34 -0
- package/dist/utxo/btc/btc_chain.d.ts.map +1 -0
- package/dist/utxo/btc/btc_chain.js +62 -0
- package/dist/utxo/btc/btc_chain.js.map +1 -0
- package/dist/utxo/btc/btc_chains.d.ts +25 -0
- package/dist/utxo/btc/btc_chains.d.ts.map +1 -0
- package/dist/utxo/btc/btc_chains.js +43 -0
- package/dist/utxo/btc/btc_chains.js.map +1 -0
- package/dist/utxo/btc/btc_token.d.ts +6 -0
- package/dist/utxo/btc/btc_token.d.ts.map +1 -0
- package/dist/utxo/btc/btc_token.js +11 -0
- package/dist/utxo/btc/btc_token.js.map +1 -0
- package/dist/utxo/btc/index.d.ts +14 -0
- package/dist/utxo/btc/index.d.ts.map +1 -0
- package/dist/utxo/btc/index.js +14 -0
- package/dist/utxo/btc/index.js.map +1 -0
- package/dist/utxo/btc/network_params.d.ts +50 -0
- package/dist/utxo/btc/network_params.d.ts.map +1 -0
- package/dist/utxo/btc/network_params.js +188 -0
- package/dist/utxo/btc/network_params.js.map +1 -0
- package/dist/utxo/btc/tools/asset_outpoint.d.ts +7 -0
- package/dist/utxo/btc/tools/asset_outpoint.d.ts.map +1 -0
- package/dist/utxo/btc/tools/asset_outpoint.js +12 -0
- package/dist/utxo/btc/tools/asset_outpoint.js.map +1 -0
- package/dist/utxo/btc/tools/bitcoin_core.tool.d.ts +41 -0
- package/dist/utxo/btc/tools/bitcoin_core.tool.d.ts.map +1 -0
- package/dist/utxo/btc/tools/bitcoin_core.tool.js +172 -0
- package/dist/utxo/btc/tools/bitcoin_core.tool.js.map +1 -0
- package/dist/utxo/btc/tools/esplora.tool.d.ts +27 -0
- package/dist/utxo/btc/tools/esplora.tool.d.ts.map +1 -0
- package/dist/utxo/btc/tools/esplora.tool.js +113 -0
- package/dist/utxo/btc/tools/esplora.tool.js.map +1 -0
- package/dist/utxo/btc/tools/inscription_index.d.ts +6 -0
- package/dist/utxo/btc/tools/inscription_index.d.ts.map +1 -0
- package/dist/utxo/btc/tools/inscription_index.js +2 -0
- package/dist/utxo/btc/tools/inscription_index.js.map +1 -0
- package/dist/utxo/btc/tools/ordiscan.tool.d.ts +19 -0
- package/dist/utxo/btc/tools/ordiscan.tool.d.ts.map +1 -0
- package/dist/utxo/btc/tools/ordiscan.tool.js +53 -0
- package/dist/utxo/btc/tools/ordiscan.tool.js.map +1 -0
- package/dist/utxo/btc/tools/rare_sat_index.d.ts +6 -0
- package/dist/utxo/btc/tools/rare_sat_index.d.ts.map +1 -0
- package/dist/utxo/btc/tools/rare_sat_index.js +2 -0
- package/dist/utxo/btc/tools/rare_sat_index.js.map +1 -0
- package/dist/utxo/btc/tools/rune_index.d.ts +6 -0
- package/dist/utxo/btc/tools/rune_index.d.ts.map +1 -0
- package/dist/utxo/btc/tools/rune_index.js +2 -0
- package/dist/utxo/btc/tools/rune_index.js.map +1 -0
- package/dist/utxo/btc/tools/unisat.tool.d.ts +18 -0
- package/dist/utxo/btc/tools/unisat.tool.d.ts.map +1 -0
- package/dist/utxo/btc/tools/unisat.tool.js +49 -0
- package/dist/utxo/btc/tools/unisat.tool.js.map +1 -0
- package/dist/utxo/coin_selection.d.ts +29 -0
- package/dist/utxo/coin_selection.d.ts.map +1 -0
- package/dist/utxo/coin_selection.js +156 -0
- package/dist/utxo/coin_selection.js.map +1 -0
- package/dist/utxo/doge/doge_chains.d.ts +17 -0
- package/dist/utxo/doge/doge_chains.d.ts.map +1 -0
- package/dist/utxo/doge/doge_chains.js +28 -0
- package/dist/utxo/doge/doge_chains.js.map +1 -0
- package/dist/utxo/doge/index.d.ts +3 -0
- package/dist/utxo/doge/index.d.ts.map +1 -0
- package/dist/utxo/doge/index.js +3 -0
- package/dist/utxo/doge/index.js.map +1 -0
- package/dist/utxo/doge/network_params.d.ts +4 -0
- package/dist/utxo/doge/network_params.d.ts.map +1 -0
- package/dist/utxo/doge/network_params.js +24 -0
- package/dist/utxo/doge/network_params.js.map +1 -0
- package/dist/utxo/ecc.d.ts +2 -0
- package/dist/utxo/ecc.d.ts.map +1 -0
- package/dist/utxo/ecc.js +11 -0
- package/dist/utxo/ecc.js.map +1 -0
- package/dist/utxo/fee.d.ts +12 -0
- package/dist/utxo/fee.d.ts.map +1 -0
- package/dist/utxo/fee.js +51 -0
- package/dist/utxo/fee.js.map +1 -0
- package/dist/utxo/index.d.ts +20 -0
- package/dist/utxo/index.d.ts.map +1 -0
- package/dist/utxo/index.js +20 -0
- package/dist/utxo/index.js.map +1 -0
- package/dist/utxo/ltc/index.d.ts +3 -0
- package/dist/utxo/ltc/index.d.ts.map +1 -0
- package/dist/utxo/ltc/index.js +3 -0
- package/dist/utxo/ltc/index.js.map +1 -0
- package/dist/utxo/ltc/ltc_chains.d.ts +17 -0
- package/dist/utxo/ltc/ltc_chains.d.ts.map +1 -0
- package/dist/utxo/ltc/ltc_chains.js +28 -0
- package/dist/utxo/ltc/ltc_chains.js.map +1 -0
- package/dist/utxo/ltc/network_params.d.ts +4 -0
- package/dist/utxo/ltc/network_params.d.ts.map +1 -0
- package/dist/utxo/ltc/network_params.js +27 -0
- package/dist/utxo/ltc/network_params.js.map +1 -0
- package/dist/utxo/script.d.ts +16 -0
- package/dist/utxo/script.d.ts.map +1 -0
- package/dist/utxo/script.js +52 -0
- package/dist/utxo/script.js.map +1 -0
- package/dist/utxo/tools/broadcaster.d.ts +6 -0
- package/dist/utxo/tools/broadcaster.d.ts.map +1 -0
- package/dist/utxo/tools/broadcaster.js +2 -0
- package/dist/utxo/tools/broadcaster.js.map +1 -0
- package/dist/utxo/tools/chain_tip_provider.d.ts +5 -0
- package/dist/utxo/tools/chain_tip_provider.d.ts.map +1 -0
- package/dist/utxo/tools/chain_tip_provider.js +2 -0
- package/dist/utxo/tools/chain_tip_provider.js.map +1 -0
- package/dist/utxo/tools/fee_estimator.d.ts +6 -0
- package/dist/utxo/tools/fee_estimator.d.ts.map +1 -0
- package/dist/utxo/tools/fee_estimator.js +2 -0
- package/dist/utxo/tools/fee_estimator.js.map +1 -0
- package/dist/utxo/tools/raw_transaction_provider.d.ts +8 -0
- package/dist/utxo/tools/raw_transaction_provider.d.ts.map +1 -0
- package/dist/utxo/tools/raw_transaction_provider.js +2 -0
- package/dist/utxo/tools/raw_transaction_provider.js.map +1 -0
- package/dist/utxo/tools/utxo_provider.d.ts +7 -0
- package/dist/utxo/tools/utxo_provider.d.ts.map +1 -0
- package/dist/utxo/tools/utxo_provider.js +2 -0
- package/dist/utxo/tools/utxo_provider.js.map +1 -0
- package/dist/utxo/unsigned_utxo_transaction.d.ts +32 -0
- package/dist/utxo/unsigned_utxo_transaction.d.ts.map +1 -0
- package/dist/utxo/unsigned_utxo_transaction.js +32 -0
- package/dist/utxo/unsigned_utxo_transaction.js.map +1 -0
- package/dist/utxo/utxo.d.ts +43 -0
- package/dist/utxo/utxo.d.ts.map +1 -0
- package/dist/utxo/utxo.js +2 -0
- package/dist/utxo/utxo.js.map +1 -0
- package/dist/utxo/utxo_chain.d.ts +102 -0
- package/dist/utxo/utxo_chain.d.ts.map +1 -0
- package/dist/utxo/utxo_chain.js +524 -0
- package/dist/utxo/utxo_chain.js.map +1 -0
- package/dist/utxo/utxo_chains.d.ts +29 -0
- package/dist/utxo/utxo_chains.d.ts.map +1 -0
- package/dist/utxo/utxo_chains.js +63 -0
- package/dist/utxo/utxo_chains.js.map +1 -0
- package/dist/utxo/utxo_gas_pricing.d.ts +22 -0
- package/dist/utxo/utxo_gas_pricing.d.ts.map +1 -0
- package/dist/utxo/utxo_gas_pricing.js +20 -0
- package/dist/utxo/utxo_gas_pricing.js.map +1 -0
- package/dist/utxo/utxo_network_params.d.ts +25 -0
- package/dist/utxo/utxo_network_params.d.ts.map +1 -0
- package/dist/utxo/utxo_network_params.js +15 -0
- package/dist/utxo/utxo_network_params.js.map +1 -0
- package/dist/utxo/utxo_transaction_status.d.ts +73 -0
- package/dist/utxo/utxo_transaction_status.d.ts.map +1 -0
- package/dist/utxo/utxo_transaction_status.js +89 -0
- package/dist/utxo/utxo_transaction_status.js.map +1 -0
- package/docs/PUBLISHING.md +119 -0
- package/docs/README.md +273 -0
- package/docs/evm.md +205 -0
- package/docs/solana.md +220 -0
- package/docs/utxo.md +364 -0
- package/package.json +94 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { bitcoinMainnetChain, bitcoinRegtestChain, bitcoinSignetChain, bitcoinTestnetChain, } from "./btc/btc_chains.js";
|
|
2
|
+
import { dogecoinMainnetChain, dogecoinTestnetChain, } from "./doge/doge_chains.js";
|
|
3
|
+
import { litecoinMainnetChain, litecoinTestnetChain, } from "./ltc/ltc_chains.js";
|
|
4
|
+
import { Slip44 } from "./utxo_network_params.js";
|
|
5
|
+
export const UtxoCoin = {
|
|
6
|
+
Bitcoin: 'bitcoin',
|
|
7
|
+
BitcoinTestnet: 'bitcoin-testnet',
|
|
8
|
+
BitcoinSignet: 'bitcoin-signet',
|
|
9
|
+
BitcoinRegtest: 'bitcoin-regtest',
|
|
10
|
+
Litecoin: 'litecoin',
|
|
11
|
+
LitecoinTestnet: 'litecoin-testnet',
|
|
12
|
+
Dogecoin: 'dogecoin',
|
|
13
|
+
DogecoinTestnet: 'dogecoin-testnet',
|
|
14
|
+
};
|
|
15
|
+
export function utxoChainFromCoin(options) {
|
|
16
|
+
switch (options.coin) {
|
|
17
|
+
case UtxoCoin.Bitcoin:
|
|
18
|
+
return bitcoinMainnetChain(options);
|
|
19
|
+
case UtxoCoin.BitcoinTestnet:
|
|
20
|
+
return bitcoinTestnetChain(options);
|
|
21
|
+
case UtxoCoin.BitcoinSignet:
|
|
22
|
+
return bitcoinSignetChain(options);
|
|
23
|
+
case UtxoCoin.BitcoinRegtest:
|
|
24
|
+
return bitcoinRegtestChain(options);
|
|
25
|
+
case UtxoCoin.Litecoin:
|
|
26
|
+
return litecoinMainnetChain(options);
|
|
27
|
+
case UtxoCoin.LitecoinTestnet:
|
|
28
|
+
return litecoinTestnetChain(options);
|
|
29
|
+
case UtxoCoin.Dogecoin:
|
|
30
|
+
return dogecoinMainnetChain(options);
|
|
31
|
+
case UtxoCoin.DogecoinTestnet:
|
|
32
|
+
return dogecoinTestnetChain(options);
|
|
33
|
+
default: {
|
|
34
|
+
const exhaustive = options;
|
|
35
|
+
throw new Error(`utxoChainFromCoin: unknown coin ${exhaustive.coin}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function utxoChainFromSlip44(slip44CoinId, isMainnet, options) {
|
|
40
|
+
if (isMainnet) {
|
|
41
|
+
if (slip44CoinId === Slip44.BTC)
|
|
42
|
+
return bitcoinMainnetChain(options);
|
|
43
|
+
if (slip44CoinId === Slip44.LTC)
|
|
44
|
+
return litecoinMainnetChain(options);
|
|
45
|
+
if (slip44CoinId === Slip44.DOGE)
|
|
46
|
+
return dogecoinMainnetChain(options);
|
|
47
|
+
throw new Error(`utxoChainFromSlip44: no mainnet chain for SLIP-44 coin ${slip44CoinId}`);
|
|
48
|
+
}
|
|
49
|
+
const variant = options.variant ?? 'testnet';
|
|
50
|
+
if (slip44CoinId === Slip44.BTC || slip44CoinId === Slip44.Testnet) {
|
|
51
|
+
if (variant === 'signet')
|
|
52
|
+
return bitcoinSignetChain(options);
|
|
53
|
+
if (variant === 'regtest')
|
|
54
|
+
return bitcoinRegtestChain(options);
|
|
55
|
+
return bitcoinTestnetChain(options);
|
|
56
|
+
}
|
|
57
|
+
if (slip44CoinId === Slip44.LTC)
|
|
58
|
+
return litecoinTestnetChain(options);
|
|
59
|
+
if (slip44CoinId === Slip44.DOGE)
|
|
60
|
+
return dogecoinTestnetChain(options);
|
|
61
|
+
throw new Error(`utxoChainFromSlip44: no testnet chain for SLIP-44 coin ${slip44CoinId}`);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=utxo_chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_chains.js","sourceRoot":"","sources":["../../utxo/utxo_chains.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,iBAAiB;IACjC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,QAAQ,EAAE,UAAU;IACpB,eAAe,EAAE,kBAAkB;IACnC,QAAQ,EAAE,UAAU;IACpB,eAAe,EAAE,kBAAkB;CAC3B,CAAC;AASX,MAAM,UAAU,iBAAiB,CAAC,OAAgC;IAChE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ,CAAC,OAAO;YACnB,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACtC,KAAK,QAAQ,CAAC,cAAc;YAC1B,OAAO,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AAC,OAAO,EAAE,CAAC;QACnE,IAAI,OAAO,KAAK,QAAQ;YAAE,OAAO,kBAAkB,CAAC,OAAqC,CAAC,CAAC;QAC3F,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,mBAAmB,CAAC,OAAqC,CAAC,CAAC;QAC7F,OAAO,mBAAmB,CAAC,OAAqC,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,KAAK,MAAM,CAAC,GAAG;QAAE,OAAO,oBAAoB,CAAC,OAAsC,CAAC,CAAC;IACrG,IAAI,YAAY,KAAK,MAAM,CAAC,IAAI;QAAE,OAAO,oBAAoB,CAAC,OAAsC,CAAC,CAAC;IACtG,MAAM,IAAI,KAAK,CAAC,0DAA0D,YAAY,EAAE,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AbstractGasPricing } from '../abstract_gas_pricing.ts';
|
|
2
|
+
import { NetworkType } from '../network_type.ts';
|
|
3
|
+
export interface UtxoGasPricingInit {
|
|
4
|
+
/**
|
|
5
|
+
* Fee rate in satoshis per virtual byte. Bitcoin Core `estimatesmartfee`
|
|
6
|
+
* returns BTC-per-kB; the SDK's `suggestFeeRate` already normalizes to
|
|
7
|
+
* sat/vB, and `UtxoGasPricing` accepts the same unit for consumer
|
|
8
|
+
* parity.
|
|
9
|
+
*/
|
|
10
|
+
satsPerVByte: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* UTXO explicit-fee override — mirrors Python's `UtxoGasPricing` at
|
|
14
|
+
* `impl/utxo/base.py`. Alternative to passing a `FeePriority` tier;
|
|
15
|
+
* the tier is resolved via `suggestFeeRate`.
|
|
16
|
+
*/
|
|
17
|
+
export declare class UtxoGasPricing extends AbstractGasPricing {
|
|
18
|
+
readonly networkType = NetworkType.BTC;
|
|
19
|
+
readonly satsPerVByte: number;
|
|
20
|
+
constructor(init: UtxoGasPricingInit);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=utxo_gas_pricing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_gas_pricing.d.ts","sourceRoot":"","sources":["../../utxo/utxo_gas_pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;IACpD,QAAQ,CAAC,WAAW,mBAAmB;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAElB,IAAI,EAAE,kBAAkB;CAUrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AbstractGasPricing } from "../abstract_gas_pricing.js";
|
|
2
|
+
import { ChainError, ChainErrorKinds } from "../errors.js";
|
|
3
|
+
import { NetworkType } from "../network_type.js";
|
|
4
|
+
/**
|
|
5
|
+
* UTXO explicit-fee override — mirrors Python's `UtxoGasPricing` at
|
|
6
|
+
* `impl/utxo/base.py`. Alternative to passing a `FeePriority` tier;
|
|
7
|
+
* the tier is resolved via `suggestFeeRate`.
|
|
8
|
+
*/
|
|
9
|
+
export class UtxoGasPricing extends AbstractGasPricing {
|
|
10
|
+
networkType = NetworkType.BTC;
|
|
11
|
+
satsPerVByte;
|
|
12
|
+
constructor(init) {
|
|
13
|
+
super();
|
|
14
|
+
if (!Number.isFinite(init.satsPerVByte) || init.satsPerVByte < 0) {
|
|
15
|
+
throw new ChainError(ChainErrorKinds.InvalidArgument, `UtxoGasPricing.satsPerVByte must be a non-negative finite number, got ${init.satsPerVByte}`);
|
|
16
|
+
}
|
|
17
|
+
this.satsPerVByte = init.satsPerVByte;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=utxo_gas_pricing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_gas_pricing.js","sourceRoot":"","sources":["../../utxo/utxo_gas_pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAYjD;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IAC3C,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC;IAC9B,YAAY,CAAS;IAE9B,YAAY,IAAwB;QAClC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YACjE,MAAM,IAAI,UAAU,CAClB,eAAe,CAAC,eAAe,EAC/B,yEAAyE,IAAI,CAAC,YAAY,EAAE,CAC7F,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { networks } from 'bitcoinjs-lib';
|
|
2
|
+
export declare const Slip44: {
|
|
3
|
+
readonly BTC: 0;
|
|
4
|
+
readonly Testnet: 1;
|
|
5
|
+
readonly LTC: 2;
|
|
6
|
+
readonly DOGE: 3;
|
|
7
|
+
};
|
|
8
|
+
export type Slip44CoinId = (typeof Slip44)[keyof typeof Slip44] | number;
|
|
9
|
+
export declare const BIP32_PURPOSE_P2PKH = 44;
|
|
10
|
+
export declare const BIP32_PURPOSE_P2SH_P2WPKH = 49;
|
|
11
|
+
export declare const BIP32_PURPOSE_P2WPKH = 84;
|
|
12
|
+
export declare const BIP32_PURPOSE_P2TR = 86;
|
|
13
|
+
export declare const FINAL_SEQUENCE = 4294967295;
|
|
14
|
+
export declare const RBF_SEQUENCE = 4294967293;
|
|
15
|
+
export declare const OP_RETURN_MAX_BYTES = 80;
|
|
16
|
+
export declare const DEFAULT_DUST_SATS = 546;
|
|
17
|
+
export interface UtxoNetworkParams {
|
|
18
|
+
name: string;
|
|
19
|
+
slip44CoinId: number;
|
|
20
|
+
networkInfo: networks.Network;
|
|
21
|
+
supportedDerivationPurposes: ReadonlySet<number>;
|
|
22
|
+
dustValueSats: number;
|
|
23
|
+
walletAddressRegex: RegExp;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=utxo_network_params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_network_params.d.ts","sourceRoot":"","sources":["../../utxo/utxo_network_params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,eAAO,MAAM,MAAM;;;;;CAKT,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,GAAG,MAAM,CAAC;AAEzE,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,cAAc,aAAa,CAAC;AACzC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC9B,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const Slip44 = {
|
|
2
|
+
BTC: 0,
|
|
3
|
+
Testnet: 1,
|
|
4
|
+
LTC: 2,
|
|
5
|
+
DOGE: 3,
|
|
6
|
+
};
|
|
7
|
+
export const BIP32_PURPOSE_P2PKH = 44;
|
|
8
|
+
export const BIP32_PURPOSE_P2SH_P2WPKH = 49;
|
|
9
|
+
export const BIP32_PURPOSE_P2WPKH = 84;
|
|
10
|
+
export const BIP32_PURPOSE_P2TR = 86;
|
|
11
|
+
export const FINAL_SEQUENCE = 0xffffffff;
|
|
12
|
+
export const RBF_SEQUENCE = 0xfffffffd;
|
|
13
|
+
export const OP_RETURN_MAX_BYTES = 80;
|
|
14
|
+
export const DEFAULT_DUST_SATS = 546;
|
|
15
|
+
//# sourceMappingURL=utxo_network_params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_network_params.js","sourceRoot":"","sources":["../../utxo/utxo_network_params.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;CACC,CAAC;AAIX,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AACzC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { NestedBalanceChanges, TransactionErrorInfo, TransactionStatus, TransactionStatusType } from '../transaction_status.ts';
|
|
2
|
+
export interface UtxoTransactionFeesInit {
|
|
3
|
+
absoluteSats: bigint;
|
|
4
|
+
vsize: number | null;
|
|
5
|
+
}
|
|
6
|
+
export declare class UtxoTransactionFees {
|
|
7
|
+
readonly absoluteSats: bigint;
|
|
8
|
+
readonly vsize: number | null;
|
|
9
|
+
constructor(init: UtxoTransactionFeesInit);
|
|
10
|
+
/** Fee rate in sat/vB. `null` when vsize is null or zero. */
|
|
11
|
+
get satsPerVByte(): number | null;
|
|
12
|
+
}
|
|
13
|
+
export interface UtxoTransactionOutputInit {
|
|
14
|
+
scriptPubkeyHex: string;
|
|
15
|
+
address: string | null;
|
|
16
|
+
valueSats: bigint;
|
|
17
|
+
}
|
|
18
|
+
export declare class UtxoTransactionOutput {
|
|
19
|
+
readonly scriptPubkeyHex: string;
|
|
20
|
+
readonly address: string | null;
|
|
21
|
+
readonly valueSats: bigint;
|
|
22
|
+
constructor(init: UtxoTransactionOutputInit);
|
|
23
|
+
}
|
|
24
|
+
export interface UtxoTransactionStatusInit {
|
|
25
|
+
chainId: number;
|
|
26
|
+
status: TransactionStatusType;
|
|
27
|
+
/**
|
|
28
|
+
* Aliased to the parent `inclusionAt`. Named `confirmationAt` here to
|
|
29
|
+
* mirror Python's `UtxoTransactionStatus.__init__` param
|
|
30
|
+
* `confirmation_datetime_utc` (impl/utxo/base.py:682).
|
|
31
|
+
*/
|
|
32
|
+
confirmationAt?: Date | null;
|
|
33
|
+
balanceChanges?: NestedBalanceChanges | null;
|
|
34
|
+
error?: TransactionErrorInfo | null;
|
|
35
|
+
outputs?: readonly UtxoTransactionOutput[] | null;
|
|
36
|
+
vsize?: number | null;
|
|
37
|
+
confirmations?: number | null;
|
|
38
|
+
fees?: UtxoTransactionFees | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* UTXO tx status. Python parity: no static factory methods; consumers build
|
|
42
|
+
* via the constructor directly (impl/utxo/base.py:677-728). Adds `fees` for
|
|
43
|
+
* parity with EVM/Solana subclass surfaces — Python's UTXO base omits it,
|
|
44
|
+
* but the consumer's deposit-detector needs the fee to reconcile net-of-fee
|
|
45
|
+
* balances. Documented deviation in SINAN_OPEN_QUESTIONS.md.
|
|
46
|
+
*
|
|
47
|
+
* **Important semantic caveat vs EVM/Solana**: `balanceChanges` on
|
|
48
|
+
* `UtxoTransactionStatus` are **gross output credits** per receiving
|
|
49
|
+
* address, NOT net per-wallet deltas. UTXO tools currently return only
|
|
50
|
+
* `vin.txid` + `vout` from providers — no per-input address/value — so the
|
|
51
|
+
* SDK can't debit inputs. A hot-wallet withdrawal will therefore record
|
|
52
|
+
* that wallet's own **change output** as a positive `AssetBalanceChange`,
|
|
53
|
+
* NOT a net debit. Consumers doing uniform cross-chain balance
|
|
54
|
+
* reconciliation must special-case UTXO. Input-side accounting is deferred
|
|
55
|
+
* to a later phase.
|
|
56
|
+
*
|
|
57
|
+
* `inputs` is not yet surfaced (the raw-tx provider returns only txid+vout,
|
|
58
|
+
* insufficient for a meaningful shape). Comes back in the 2C UTXO port.
|
|
59
|
+
*/
|
|
60
|
+
export declare class UtxoTransactionStatus extends TransactionStatus {
|
|
61
|
+
readonly outputs: readonly UtxoTransactionOutput[] | null;
|
|
62
|
+
readonly vsize: number | null;
|
|
63
|
+
readonly confirmations: number | null;
|
|
64
|
+
readonly fees: UtxoTransactionFees | null;
|
|
65
|
+
constructor(init: UtxoTransactionStatusInit);
|
|
66
|
+
/**
|
|
67
|
+
* Alias for the parent's `inclusionAt` field, exposed under the Python name
|
|
68
|
+
* `confirmationAt` for readability at consumer call sites. Same underlying
|
|
69
|
+
* value; do not use both interchangeably in diffs.
|
|
70
|
+
*/
|
|
71
|
+
get confirmationAt(): Date | null;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=utxo_transaction_status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_transaction_status.d.ts","sourceRoot":"","s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BAAmB,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GAAG,IAAI,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAC;gBAE9B,IAAI,EAAE,yBAAyB;IA0B3C;;;;OAIG;IACH,IAAI,cAAc,IAAI,IAAI,GAAG,IAAI,CAEhC;CACF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ChainError, ChainErrorKinds } from "../errors.js";
|
|
2
|
+
import { TransactionStatus, } from "../transaction_status.js";
|
|
3
|
+
export class UtxoTransactionFees {
|
|
4
|
+
absoluteSats;
|
|
5
|
+
vsize;
|
|
6
|
+
constructor(init) {
|
|
7
|
+
if (init.absoluteSats < 0n) {
|
|
8
|
+
throw new ChainError(ChainErrorKinds.InvalidArgument, `UtxoTransactionFees.absoluteSats must be >= 0, got ${init.absoluteSats}`);
|
|
9
|
+
}
|
|
10
|
+
if (init.vsize !== null && (!Number.isFinite(init.vsize) || init.vsize < 0)) {
|
|
11
|
+
throw new ChainError(ChainErrorKinds.InvalidArgument, `UtxoTransactionFees.vsize must be a non-negative number or null, got ${init.vsize}`);
|
|
12
|
+
}
|
|
13
|
+
this.absoluteSats = init.absoluteSats;
|
|
14
|
+
this.vsize = init.vsize;
|
|
15
|
+
}
|
|
16
|
+
/** Fee rate in sat/vB. `null` when vsize is null or zero. */
|
|
17
|
+
get satsPerVByte() {
|
|
18
|
+
if (this.vsize === null || this.vsize === 0)
|
|
19
|
+
return null;
|
|
20
|
+
return Number(this.absoluteSats) / this.vsize;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class UtxoTransactionOutput {
|
|
24
|
+
scriptPubkeyHex;
|
|
25
|
+
address;
|
|
26
|
+
valueSats;
|
|
27
|
+
constructor(init) {
|
|
28
|
+
if (init.valueSats < 0n) {
|
|
29
|
+
throw new ChainError(ChainErrorKinds.InvalidArgument, `UtxoTransactionOutput.valueSats must be >= 0, got ${init.valueSats}`);
|
|
30
|
+
}
|
|
31
|
+
this.scriptPubkeyHex = init.scriptPubkeyHex;
|
|
32
|
+
this.address = init.address;
|
|
33
|
+
this.valueSats = init.valueSats;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* UTXO tx status. Python parity: no static factory methods; consumers build
|
|
38
|
+
* via the constructor directly (impl/utxo/base.py:677-728). Adds `fees` for
|
|
39
|
+
* parity with EVM/Solana subclass surfaces — Python's UTXO base omits it,
|
|
40
|
+
* but the consumer's deposit-detector needs the fee to reconcile net-of-fee
|
|
41
|
+
* balances. Documented deviation in SINAN_OPEN_QUESTIONS.md.
|
|
42
|
+
*
|
|
43
|
+
* **Important semantic caveat vs EVM/Solana**: `balanceChanges` on
|
|
44
|
+
* `UtxoTransactionStatus` are **gross output credits** per receiving
|
|
45
|
+
* address, NOT net per-wallet deltas. UTXO tools currently return only
|
|
46
|
+
* `vin.txid` + `vout` from providers — no per-input address/value — so the
|
|
47
|
+
* SDK can't debit inputs. A hot-wallet withdrawal will therefore record
|
|
48
|
+
* that wallet's own **change output** as a positive `AssetBalanceChange`,
|
|
49
|
+
* NOT a net debit. Consumers doing uniform cross-chain balance
|
|
50
|
+
* reconciliation must special-case UTXO. Input-side accounting is deferred
|
|
51
|
+
* to a later phase.
|
|
52
|
+
*
|
|
53
|
+
* `inputs` is not yet surfaced (the raw-tx provider returns only txid+vout,
|
|
54
|
+
* insufficient for a meaningful shape). Comes back in the 2C UTXO port.
|
|
55
|
+
*/
|
|
56
|
+
export class UtxoTransactionStatus extends TransactionStatus {
|
|
57
|
+
outputs;
|
|
58
|
+
vsize;
|
|
59
|
+
confirmations;
|
|
60
|
+
fees;
|
|
61
|
+
constructor(init) {
|
|
62
|
+
super({
|
|
63
|
+
chainId: init.chainId,
|
|
64
|
+
status: init.status,
|
|
65
|
+
inclusionAt: init.confirmationAt,
|
|
66
|
+
error: init.error,
|
|
67
|
+
balanceChanges: init.balanceChanges,
|
|
68
|
+
});
|
|
69
|
+
if (init.vsize !== undefined && init.vsize !== null && init.vsize < 0) {
|
|
70
|
+
throw new ChainError(ChainErrorKinds.InvalidArgument, `UtxoTransactionStatus.vsize must be >= 0 or null, got ${init.vsize}`);
|
|
71
|
+
}
|
|
72
|
+
if (init.confirmations !== undefined && init.confirmations !== null && init.confirmations < 0) {
|
|
73
|
+
throw new ChainError(ChainErrorKinds.InvalidArgument, `UtxoTransactionStatus.confirmations must be >= 0 or null, got ${init.confirmations}`);
|
|
74
|
+
}
|
|
75
|
+
this.outputs = init.outputs ?? null;
|
|
76
|
+
this.vsize = init.vsize ?? null;
|
|
77
|
+
this.confirmations = init.confirmations ?? null;
|
|
78
|
+
this.fees = init.fees ?? null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Alias for the parent's `inclusionAt` field, exposed under the Python name
|
|
82
|
+
* `confirmationAt` for readability at consumer call sites. Same underlying
|
|
83
|
+
* value; do not use both interchangeably in diffs.
|
|
84
|
+
*/
|
|
85
|
+
get confirmationAt() {
|
|
86
|
+
return this.inclusionAt;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=utxo_transaction_status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utxo_transaction_status.js","sourceRoot":"","sources":["../../utxo/utxo_transaction_status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAGL,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAOlC,MAAM,OAAO,mBAAmB;IACrB,YAAY,CAAS;IACrB,KAAK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AAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Publishing `@getomnichain/omnichain`
|
|
2
|
+
|
|
3
|
+
One-time setup + per-release workflow. Assumes the repo is being migrated from `pluton-bridge/omnichain` (private, source-only submodule) to `getomnichain/omnichain` (public, npm-published package).
|
|
4
|
+
|
|
5
|
+
## Naming convention rationale
|
|
6
|
+
|
|
7
|
+
Per the [npm docs](https://docs.npmjs.com/cli/v11/using-npm/scope/) and the [npm naming policy](https://docs.npmjs.com/files/package.json/): **don't put `js` or `node` in the name — it's assumed.** No `.js` suffix (that convention is only used when the library IS the framework, e.g. `three`, and even then modern projects drop it). No uppercase. Scoped names for org identity are the current standard.
|
|
8
|
+
|
|
9
|
+
- **Package name:** `@getomnichain/omnichain`
|
|
10
|
+
- **Rejected:** `omnichain.js` (anti-idiom for TS-first libs); `omnichain-ts` (redundant — types ship inside); bare `omnichain` (unscoped, larger namespace-collision risk)
|
|
11
|
+
- **npm slot check** (`2026-07-27`): `omnichain` and `@getomnichain/*` both `404 Not Found` on the registry — both free.
|
|
12
|
+
|
|
13
|
+
Mirrors Python: `getomnichain/omnichain-py` on GitHub + `omnichain-py` on PyPI. TS gets `getomnichain/omnichain` on GitHub + `@getomnichain/omnichain` on npm.
|
|
14
|
+
|
|
15
|
+
## One-time setup
|
|
16
|
+
|
|
17
|
+
### 1. Create GitHub repo under the org
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Requires a PAT with `repo` scope + membership in the `getomnichain` org.
|
|
21
|
+
gh repo create getomnichain/omnichain \
|
|
22
|
+
--public \
|
|
23
|
+
--description "Multi-chain SDK — TS parity port of omnichain-py" \
|
|
24
|
+
--source . \
|
|
25
|
+
--push
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`gh repo create` will not overwrite an existing remote; if you already ran it, add the remote by hand:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git remote add upstream https://github.com/getomnichain/omnichain.git
|
|
32
|
+
git push upstream main
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Keep `origin` pointing at `pluton-bridge/omnichain` until you're ready to sunset the private mirror. `scripts/release.sh` pushes to both remotes on every release.
|
|
36
|
+
|
|
37
|
+
### 2. Create the npm org
|
|
38
|
+
|
|
39
|
+
Log in to npmjs.com and create the `getomnichain` organization (Free tier is fine for public packages). Add publisher accounts as members.
|
|
40
|
+
|
|
41
|
+
### 3. Generate an npm automation token
|
|
42
|
+
|
|
43
|
+
Account → Access Tokens → New Automation Token (scope: **Publish**, allowlist to `@getomnichain/*`). Store it as `NPM_TOKEN`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Local dev: put it in ~/.npmrc under a home-scoped auth line, OR set env each release
|
|
47
|
+
export NPM_TOKEN=npm_XXXXXXXXXXXXX
|
|
48
|
+
|
|
49
|
+
# CI: add to repo secrets as NPM_TOKEN (used by scripts/release.sh)
|
|
50
|
+
gh secret set NPM_TOKEN --repo getomnichain/omnichain
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 4. Install build + test deps
|
|
54
|
+
|
|
55
|
+
`package.json` is checked in but `node_modules/` is not. First-time bootstrap:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 5. Sanity-check the build
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm run typecheck # tsc --noEmit
|
|
65
|
+
npm run build # emits dist/
|
|
66
|
+
npm test # jest via @jest/globals
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`npm run build` uses `tsc` with `rewriteRelativeImportExtensions: true` (TS 5.7+) so the source's `.ts` extension imports emit as `.js` in `dist/`. If a consumer is stuck on TS ≤ 5.6, `dist/` is still valid JS — this only matters for developing this package.
|
|
70
|
+
|
|
71
|
+
## Per-release workflow
|
|
72
|
+
|
|
73
|
+
`scripts/release.sh` does everything atomically. From a clean working tree on the branch you're releasing:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
scripts/release.sh patch # 0.2.0 → 0.2.1 (backport/bug fix)
|
|
77
|
+
scripts/release.sh minor # 0.2.0 → 0.3.0 (additive)
|
|
78
|
+
scripts/release.sh major # 0.2.0 → 1.0.0 (breaking)
|
|
79
|
+
scripts/release.sh 0.2.1 # explicit
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Steps run in this order (fails fast if any step errors):
|
|
83
|
+
|
|
84
|
+
1. Reject if working tree dirty.
|
|
85
|
+
2. `npm version <bump> --no-git-tag-version` — bumps `package.json`.
|
|
86
|
+
3. `git commit` + `git tag v<X.Y.Z>`.
|
|
87
|
+
4. `npm run build` — produces `dist/`.
|
|
88
|
+
5. `npm publish --access public` — uses `NPM_TOKEN` if set, else interactive auth.
|
|
89
|
+
6. `git push origin <branch> && git push origin v<X.Y.Z>`.
|
|
90
|
+
7. Same to `upstream` if configured.
|
|
91
|
+
|
|
92
|
+
Requires the caller to be on the branch they want to release from. Typical flow: land your feature branch to `main`, `git checkout main && git pull`, then `scripts/release.sh minor`.
|
|
93
|
+
|
|
94
|
+
## What ships to npm vs what stays on GitHub
|
|
95
|
+
|
|
96
|
+
Controlled by the `files` allowlist in `package.json` (more restrictive than `.npmignore`). Currently:
|
|
97
|
+
|
|
98
|
+
- **Ships:** `dist/`, `docs/`, `README.md`, `LICENSE`, `CHANGELOG.md`, `package.json`.
|
|
99
|
+
- **Stays on GitHub only:** `test/`, `**/test/`, `code-review/`, source `.ts` files, `.claude/`, `scripts/`, `tsconfig*.json`.
|
|
100
|
+
|
|
101
|
+
Consumers get the compiled `.js` + `.d.ts` in `dist/`, keeping the tarball small. Source is browsable on GitHub for anyone who wants to read the implementation.
|
|
102
|
+
|
|
103
|
+
## Version policy
|
|
104
|
+
|
|
105
|
+
- **`0.x`** while the API is still tracking Python-parity waves. Any wave that changes an existing public API is a **minor** bump under 0.x semver (breaking changes without a major bump are permitted only in 0.x).
|
|
106
|
+
- **`1.0`** ships once every deferred Wave 2B item is wired (`isFullBalance`, `gasPricing` per-chain, UTXO `amountHr` design pass) AND parity with `omnichain-py` `main` is asserted.
|
|
107
|
+
|
|
108
|
+
## Reverting a bad publish
|
|
109
|
+
|
|
110
|
+
npm allows `npm unpublish` only within 72 hours and only if no dependents exist. Prefer publishing a `.1` patch with a fix over unpublishing.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# If truly urgent, within 72h, and nobody depends on it:
|
|
114
|
+
npm unpublish @getomnichain/omnichain@0.2.1
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Migrating consumers from the git submodule
|
|
118
|
+
|
|
119
|
+
Consumers currently importing `omnichain` as a git submodule (e.g. under `services/*/omnichain/`) should switch to `@getomnichain/omnichain` in `package.json` on the same commit that lands `npm install decimal.js` (the Wave 2B hard merge gate). Bumps become `npm install @getomnichain/omnichain@0.2.0` instead of `git submodule update --remote`.
|