@btc-vision/transaction 1.0.52 → 1.0.54
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/browser/_version.d.ts +1 -1
- package/browser/index.js +1 -1
- package/browser/transaction/browser/Web3Provider.d.ts +7 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/tests/deploy/deployMoto.d.ts +4 -0
- package/build/tests/deploy/deployMoto.js +89 -0
- package/build/tests/deploy/deployPool.d.ts +1 -0
- package/build/tests/deploy/deployPool.js +5 -0
- package/build/tests/deploy/deployStep1.d.ts +1 -0
- package/build/tests/deploy/deployStep1.js +5 -0
- package/build/tests/deploy/deployStep2.d.ts +1 -0
- package/build/tests/deploy/deployStep2.js +5 -0
- package/build/tests/deploy/deployStep3.d.ts +1 -0
- package/build/tests/deploy/deployStep3.js +5 -0
- package/build/tests/moto/airdropToken.js +1 -1
- package/build/tests/moto/airdropTokens.js +11 -1
- package/build/tests/moto/allowance.js +2 -1
- package/build/tests/moto/balanceOf.js +1 -2
- package/build/tests/motoswap/routerAddLiquidity.js +2 -3
- package/build/tests/motoswap-router/addLiquidity.d.ts +11 -0
- package/build/tests/motoswap-router/addLiquidity.js +35 -0
- package/build/tests/motoswap-router/deployMoto.d.ts +4 -0
- package/build/tests/motoswap-router/deployMoto.js +89 -0
- package/build/tests/motoswap-router/deployPool.d.ts +1 -0
- package/build/tests/motoswap-router/deployPool.js +5 -0
- package/build/tests/motoswap-router/deployStep1.d.ts +1 -0
- package/build/tests/motoswap-router/deployStep1.js +5 -0
- package/build/tests/motoswap-router/deployStep2.d.ts +1 -0
- package/build/tests/motoswap-router/deployStep2.js +5 -0
- package/build/tests/motoswap-router/deployStep3.d.ts +1 -0
- package/build/tests/motoswap-router/deployStep3.js +5 -0
- package/build/tests/motoswap-router/getAmountsOut.d.ts +5 -0
- package/build/tests/motoswap-router/getAmountsOut.js +34 -0
- package/build/tests/motoswap-router/routerAddLiquidity.d.ts +11 -0
- package/build/tests/motoswap-router/routerAddLiquidity.js +35 -0
- package/build/tests/motoswap-router/swap.d.ts +8 -0
- package/build/tests/motoswap-router/swap.js +24 -0
- package/build/tests/pool/DecodePoolAddress.d.ts +6 -0
- package/build/tests/pool/DecodePoolAddress.js +12 -0
- package/build/tests/pool/decodeReserves.d.ts +5 -0
- package/build/tests/pool/decodeReserves.js +13 -0
- package/build/tests/pool/reserves.d.ts +1 -0
- package/build/tests/pool/reserves.js +18 -0
- package/build/tests/shared/Utils.js +6 -1
- package/build/tests/shared/interaction.js +1 -1
- package/build/tests/wbtc/wrapReg.js +2 -5
- package/build/tests/writers/approve.js +1 -1
- package/build/transaction/browser/Web3Provider.d.ts +7 -1
- package/package.json +2 -1
- package/src/_version.ts +1 -1
- package/src/transaction/browser/Web3Provider.ts +11 -0
|
@@ -20,7 +20,7 @@ async function mineBlock() {
|
|
|
20
20
|
return !!ok.length;
|
|
21
21
|
}
|
|
22
22
|
await rpc.init(Regtest.config);
|
|
23
|
-
const wrapAmount =
|
|
23
|
+
const wrapAmount = 5n * 100000000n;
|
|
24
24
|
const utxoSetting = {
|
|
25
25
|
addresses: [wallet.p2wpkh, wallet.p2tr],
|
|
26
26
|
minAmount: 10000n,
|
|
@@ -41,7 +41,7 @@ const wrapParameters = {
|
|
|
41
41
|
network: network,
|
|
42
42
|
feeRate: 500,
|
|
43
43
|
priorityFee: 100000n,
|
|
44
|
-
receiver:
|
|
44
|
+
receiver: 'bcrt1ppqk36azyunxdpadza7gtf568elqxnhu3lwufg98daek3kz07390swyvzd2',
|
|
45
45
|
amount: wrapAmount,
|
|
46
46
|
generationParameters: generationParameters,
|
|
47
47
|
};
|
|
@@ -61,8 +61,5 @@ console.log(`Second transaction broadcasted: ${secondTxBroadcast}`);
|
|
|
61
61
|
if (!secondTxBroadcast) {
|
|
62
62
|
throw new Error('Could not broadcast second transaction');
|
|
63
63
|
}
|
|
64
|
-
if (shouldMineBlock) {
|
|
65
|
-
await mineBlock();
|
|
66
|
-
}
|
|
67
64
|
rpc.destroy();
|
|
68
65
|
console.log(`Wrapped ${wrapAmount} sats to ${wallet.p2tr}.`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ABICoder, BinaryWriter } from '@btc-vision/bsi-binary';
|
|
2
2
|
const abiCoder = new ABICoder();
|
|
3
3
|
const approveSelector = Number(`0x` + abiCoder.encodeSelector('approve'));
|
|
4
|
-
export const MAX_UINT256 = 2n ** 256n -
|
|
4
|
+
export const MAX_UINT256 = 2n ** 256n - 1n;
|
|
5
5
|
export function approve(spender, amount = MAX_UINT256) {
|
|
6
6
|
const calldata = new BinaryWriter();
|
|
7
7
|
calldata.writeSelector(approveSelector);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { IInteractionParameters } from '../interfaces/ITransactionParameters.js';
|
|
2
2
|
import { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
3
3
|
export type InteractionParametersWithoutSigner = Omit<IInteractionParameters, 'signer'>;
|
|
4
|
+
export interface BroadcastTransactionOptions {
|
|
5
|
+
raw: string;
|
|
6
|
+
psbt: boolean;
|
|
7
|
+
}
|
|
4
8
|
export interface BroadcastedTransaction {
|
|
5
9
|
readonly success: boolean;
|
|
6
10
|
readonly result?: string;
|
|
@@ -9,5 +13,7 @@ export interface BroadcastedTransaction {
|
|
|
9
13
|
readonly identifier: bigint | string;
|
|
10
14
|
}
|
|
11
15
|
export interface Web3Provider {
|
|
12
|
-
signInteraction(interactionParameters: InteractionParametersWithoutSigner): Promise<[
|
|
16
|
+
signInteraction(interactionParameters: InteractionParametersWithoutSigner): Promise<[string, string, UTXO[]]>;
|
|
17
|
+
signAndBroadcastInteraction(interactionParameters: InteractionParametersWithoutSigner): Promise<[BroadcastedTransaction, BroadcastedTransaction, UTXO[]]>;
|
|
18
|
+
broadcast(transactions: BroadcastTransactionOptions[]): Promise<BroadcastedTransaction[]>;
|
|
13
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"author": "BlobMaster41",
|
|
5
5
|
"description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
|
|
6
6
|
"engines": {
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"babel-preset-react": "^6.24.1",
|
|
97
97
|
"babelify": "^10.0.0",
|
|
98
98
|
"bech32": "^2.0.0",
|
|
99
|
+
"bignumber.js": "^9.1.2",
|
|
99
100
|
"bip32": "^4.0.0",
|
|
100
101
|
"bitcoinjs-lib": "github:btc-vision/bitcoinjs-lib",
|
|
101
102
|
"browserify-zlib": "^0.2.0",
|
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.54';
|
|
@@ -3,6 +3,11 @@ import { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
|
3
3
|
|
|
4
4
|
export type InteractionParametersWithoutSigner = Omit<IInteractionParameters, 'signer'>; //| 'utxos'
|
|
5
5
|
|
|
6
|
+
export interface BroadcastTransactionOptions {
|
|
7
|
+
raw: string;
|
|
8
|
+
psbt: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
export interface BroadcastedTransaction {
|
|
7
12
|
/** Whether the transaction was successfully broadcasted. */
|
|
8
13
|
readonly success: boolean;
|
|
@@ -31,5 +36,11 @@ export interface BroadcastedTransaction {
|
|
|
31
36
|
export interface Web3Provider {
|
|
32
37
|
signInteraction(
|
|
33
38
|
interactionParameters: InteractionParametersWithoutSigner,
|
|
39
|
+
): Promise<[string, string, UTXO[]]>;
|
|
40
|
+
|
|
41
|
+
signAndBroadcastInteraction(
|
|
42
|
+
interactionParameters: InteractionParametersWithoutSigner,
|
|
34
43
|
): Promise<[BroadcastedTransaction, BroadcastedTransaction, UTXO[]]>;
|
|
44
|
+
|
|
45
|
+
broadcast(transactions: BroadcastTransactionOptions[]): Promise<BroadcastedTransaction[]>;
|
|
35
46
|
}
|