opnet 1.0.62 → 1.1.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/browser/_version.d.ts +1 -1
- package/browser/abi/interfaces/BaseContractProperties.d.ts +2 -2
- package/browser/abi/interfaces/BitcoinAbiValue.d.ts +1 -1
- package/browser/abi/shared/interfaces/IMotoswapFactoryContract.d.ts +4 -4
- package/browser/abi/shared/interfaces/IMotoswapPoolContract.d.ts +10 -10
- package/browser/abi/shared/interfaces/IMotoswapRouterContract.d.ts +12 -12
- package/browser/abi/shared/interfaces/IOP_20Contract.d.ts +58 -13
- package/browser/abi/shared/interfaces/IOP_NETContract.d.ts +4 -4
- package/browser/abi/shared/interfaces/IStackingContract.d.ts +1 -1
- package/browser/abi/shared/interfaces/IWBTCContract.d.ts +3 -3
- package/browser/common/CommonTypes.d.ts +2 -4
- package/browser/contracts/CallResult.d.ts +31 -5
- package/browser/contracts/Contract.d.ts +17 -8
- package/browser/contracts/ContractData.d.ts +1 -1
- package/browser/contracts/OPNetEvent.d.ts +2 -3
- package/browser/contracts/interfaces/ICallResult.d.ts +12 -2
- package/browser/contracts/interfaces/IContract.d.ts +6 -4
- package/browser/contracts/interfaces/IRawContract.d.ts +1 -1
- package/browser/index.js +1 -1
- package/browser/index.js.LICENSE.txt +2 -2
- package/browser/opnet.d.ts +28 -31
- package/browser/providers/AbstractRpcProvider.d.ts +9 -6
- package/browser/providers/interfaces/JSONRpcMethods.d.ts +2 -1
- package/browser/transactions/decoders/DeploymentTransaction.d.ts +4 -4
- package/browser/transactions/decoders/InteractionTransaction.d.ts +2 -1
- package/browser/transactions/interfaces/ITransactionReceipt.d.ts +1 -1
- package/browser/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -1
- package/browser/transactions/interfaces/transactions/IDeploymentTransaction.d.ts +2 -3
- package/browser/transactions/interfaces/transactions/IInteractionTransaction.d.ts +2 -1
- package/browser/transactions/interfaces/transactions/IUnwrapTransaction.d.ts +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/interfaces/BaseContractProperties.d.ts +2 -2
- package/build/abi/interfaces/BitcoinAbiValue.d.ts +1 -1
- package/build/abi/shared/interfaces/IMotoswapFactoryContract.d.ts +4 -4
- package/build/abi/shared/interfaces/IMotoswapPoolContract.d.ts +10 -10
- package/build/abi/shared/interfaces/IMotoswapRouterContract.d.ts +12 -12
- package/build/abi/shared/interfaces/IOP_20Contract.d.ts +58 -13
- package/build/abi/shared/interfaces/IOP_NETContract.d.ts +4 -4
- package/build/abi/shared/interfaces/IStackingContract.d.ts +1 -1
- package/build/abi/shared/interfaces/IWBTCContract.d.ts +3 -3
- package/build/abi/shared/json/MOTOSWAP_FACTORY_ABI.js +1 -1
- package/build/abi/shared/json/MOTOSWAP_POOL_ABI.js +1 -1
- package/build/abi/shared/json/MOTOSWAP_ROUTER_ABI.js +1 -1
- package/build/abi/shared/json/MOTO_TOKEN_ABI.js +2 -2
- package/build/abi/shared/json/OP_20_ABI.js +51 -24
- package/build/abi/shared/json/OP_NET_ABI.js +1 -1
- package/build/abi/shared/json/STAKING_ABI.js +1 -1
- package/build/abi/shared/json/WBTC_ABI.js +1 -1
- package/build/common/CommonTypes.d.ts +2 -4
- package/build/contracts/CallResult.d.ts +31 -5
- package/build/contracts/CallResult.js +96 -3
- package/build/contracts/Contract.d.ts +17 -8
- package/build/contracts/Contract.js +60 -18
- package/build/contracts/ContractData.d.ts +1 -1
- package/build/contracts/OPNetEvent.d.ts +2 -3
- package/build/contracts/OPNetEvent.js +3 -4
- package/build/contracts/interfaces/ICallResult.d.ts +12 -2
- package/build/contracts/interfaces/IContract.d.ts +6 -4
- package/build/contracts/interfaces/IRawContract.d.ts +1 -1
- package/build/opnet.d.ts +28 -31
- package/build/opnet.js +28 -31
- package/build/providers/AbstractRpcProvider.d.ts +9 -6
- package/build/providers/AbstractRpcProvider.js +33 -17
- package/build/providers/interfaces/JSONRpcMethods.d.ts +2 -1
- package/build/providers/interfaces/JSONRpcMethods.js +1 -0
- package/build/storage/StoredValue.js +1 -1
- package/build/transactions/decoders/DeploymentTransaction.d.ts +4 -4
- package/build/transactions/decoders/DeploymentTransaction.js +4 -4
- package/build/transactions/decoders/InteractionTransaction.d.ts +2 -1
- package/build/transactions/decoders/InteractionTransaction.js +2 -1
- package/build/transactions/decoders/UnwrapTransaction.js +0 -1
- package/build/transactions/interfaces/ITransactionReceipt.d.ts +1 -1
- package/build/transactions/interfaces/transactions/ICommonTransaction.d.ts +2 -1
- package/build/transactions/interfaces/transactions/IDeploymentTransaction.d.ts +2 -3
- package/build/transactions/interfaces/transactions/IInteractionTransaction.d.ts +2 -1
- package/build/transactions/interfaces/transactions/IUnwrapTransaction.d.ts +1 -1
- package/build/transactions/metadata/TransactionReceipt.js +2 -2
- package/package.json +5 -5
- package/src/_version.ts +1 -1
- package/src/abi/interfaces/BaseContractProperties.ts +2 -2
- package/src/abi/interfaces/BitcoinAbiValue.ts +1 -1
- package/src/abi/shared/interfaces/IMotoswapFactoryContract.ts +6 -6
- package/src/abi/shared/interfaces/IMotoswapPoolContract.ts +18 -23
- package/src/abi/shared/interfaces/IMotoswapRouterContract.ts +20 -28
- package/src/abi/shared/interfaces/IOP_20Contract.ts +44 -22
- package/src/abi/shared/interfaces/IOP_NETContract.ts +4 -4
- package/src/abi/shared/interfaces/IStackingContract.ts +1 -1
- package/src/abi/shared/interfaces/IWBTCContract.ts +5 -5
- package/src/abi/shared/json/MOTOSWAP_FACTORY_ABI.ts +1 -1
- package/src/abi/shared/json/MOTOSWAP_POOL_ABI.ts +1 -1
- package/src/abi/shared/json/MOTOSWAP_ROUTER_ABI.ts +1 -1
- package/src/abi/shared/json/MOTO_TOKEN_ABI.ts +2 -2
- package/src/abi/shared/json/OP_20_ABI.ts +52 -24
- package/src/abi/shared/json/OP_NET_ABI.ts +1 -1
- package/src/abi/shared/json/STAKING_ABI.ts +1 -1
- package/src/abi/shared/json/WBTC_ABI.ts +1 -1
- package/src/common/CommonTypes.ts +3 -4
- package/src/contracts/CallResult.ts +155 -8
- package/src/contracts/Contract.ts +138 -37
- package/src/contracts/ContractData.ts +1 -1
- package/src/contracts/OPNetEvent.ts +2 -3
- package/src/contracts/interfaces/ICallResult.ts +15 -2
- package/src/contracts/interfaces/IContract.ts +8 -4
- package/src/contracts/interfaces/IRawContract.ts +1 -1
- package/src/opnet.ts +28 -31
- package/src/providers/AbstractRpcProvider.ts +78 -20
- package/src/providers/interfaces/JSONRpcMethods.ts +3 -0
- package/src/providers/interfaces/PublicKeyInfo.d.ts +20 -0
- package/src/storage/StoredValue.ts +1 -1
- package/src/transactions/Transaction.ts +0 -1
- package/src/transactions/decoders/DeploymentTransaction.ts +9 -9
- package/src/transactions/decoders/InteractionTransaction.ts +3 -2
- package/src/transactions/decoders/UnwrapTransaction.ts +0 -2
- package/src/transactions/interfaces/ITransactionReceipt.ts +1 -1
- package/src/transactions/interfaces/transactions/ICommonTransaction.ts +2 -1
- package/src/transactions/interfaces/transactions/IDeploymentTransaction.ts +2 -11
- package/src/transactions/interfaces/transactions/IInteractionTransaction.ts +2 -1
- package/src/transactions/interfaces/transactions/IUnwrapTransaction.ts +1 -1
- package/src/transactions/metadata/TransactionReceipt.ts +2 -2
- package/browser/abi/BaseContractProperty.d.ts +0 -3
- package/browser/abi/shared/interfaces/IMotoContract.d.ts +0 -6
- package/browser/bitcoin/BitcoinAddress.d.ts +0 -20
- package/build/abi/BaseContractProperty.d.ts +0 -3
- package/build/abi/BaseContractProperty.js +0 -1
- package/build/abi/shared/interfaces/IMotoContract.d.ts +0 -6
- package/build/abi/shared/interfaces/IMotoContract.js +0 -1
- package/build/bitcoin/BitcoinAddress.d.ts +0 -20
- package/build/bitcoin/BitcoinAddress.js +0 -103
- package/src/abi/BaseContractProperty.ts +0 -8
- package/src/abi/shared/interfaces/IMotoContract.ts +0 -17
- package/src/bitcoin/BitcoinAddress.ts +0 -137
package/browser/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0
|
|
1
|
+
export declare const version = "1.1.0";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { CallResult } from '../../contracts/CallResult.js';
|
|
1
2
|
import { IContract } from '../../contracts/interfaces/IContract.js';
|
|
2
|
-
import { BaseContractProperty } from '../BaseContractProperty.js';
|
|
3
3
|
export interface BaseContractProperties extends IContract {
|
|
4
|
-
[key: symbol]:
|
|
4
|
+
[key: symbol]: CallResult;
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address } from '@btc-vision/
|
|
2
|
-
import {
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
import { CallResult } from '../../../contracts/CallResult.js';
|
|
3
3
|
import { IOP_NETContract } from './IOP_NETContract.js';
|
|
4
4
|
export interface IMotoswapFactoryContract extends IOP_NETContract {
|
|
5
|
-
getPool(token0: Address, token1: Address): Promise<
|
|
6
|
-
createPool(token0: Address, token1: Address): Promise<
|
|
5
|
+
getPool(token0: Address, token1: Address): Promise<CallResult>;
|
|
6
|
+
createPool(token0: Address, token1: Address): Promise<CallResult>;
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Address } from '@btc-vision/
|
|
2
|
-
import {
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
import { CallResult } from '../../../contracts/CallResult.js';
|
|
3
3
|
import { IOP_20Contract } from './IOP_20Contract.js';
|
|
4
4
|
export interface IMotoswapPoolContract extends Omit<IOP_20Contract, 'burn' | 'mint'> {
|
|
5
|
-
token0(): Promise<
|
|
6
|
-
token1(): Promise<
|
|
7
|
-
getReserves(): Promise<
|
|
8
|
-
swap(amount0Out: bigint, amount1Out: bigint, to: string, data: Uint8Array): Promise<
|
|
9
|
-
burn(to: Address): Promise<
|
|
10
|
-
sync(): Promise<
|
|
11
|
-
price0CumulativeLast(): Promise<
|
|
12
|
-
price1CumulativeLast(): Promise<
|
|
5
|
+
token0(): Promise<CallResult>;
|
|
6
|
+
token1(): Promise<CallResult>;
|
|
7
|
+
getReserves(): Promise<CallResult>;
|
|
8
|
+
swap(amount0Out: bigint, amount1Out: bigint, to: string, data: Uint8Array): Promise<CallResult>;
|
|
9
|
+
burn(to: Address): Promise<CallResult>;
|
|
10
|
+
sync(): Promise<CallResult>;
|
|
11
|
+
price0CumulativeLast(): Promise<CallResult>;
|
|
12
|
+
price1CumulativeLast(): Promise<CallResult>;
|
|
13
13
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Address } from '@btc-vision/
|
|
2
|
-
import {
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
import { CallResult } from '../../../contracts/CallResult.js';
|
|
3
3
|
import { IOP_NETContract } from './IOP_NETContract.js';
|
|
4
4
|
export interface IMotoswapRouterContract extends IOP_NETContract {
|
|
5
|
-
addLiquidity(tokenA: Address, tokenB: Address, amountADesired: bigint, amountBDesired: bigint, amountAMin: bigint, amountBMin: bigint, to: Address, deadline: bigint): Promise<
|
|
6
|
-
removeLiquidity(tokenA: Address, tokenB: Address, liquidity: bigint, amountAMin: bigint, amountBMin: bigint, to: Address, deadline: bigint): Promise<
|
|
7
|
-
quote(amountA: bigint, reserveA: bigint, reserveB: bigint): Promise<
|
|
8
|
-
getAmountOut(amountIn: bigint, reserveIn: bigint, reserveOut: bigint): Promise<
|
|
9
|
-
getAmountIn(amountOut: bigint, reserveIn: bigint, reserveOut: bigint): Promise<
|
|
10
|
-
getAmountsOut(amountIn: bigint, path: Address[]): Promise<
|
|
11
|
-
getAmountsIn(amountOut: bigint, path: Address[]): Promise<
|
|
12
|
-
swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: bigint, amountOutMin: bigint, path: Address[], to: Address, deadline: bigint): Promise<
|
|
13
|
-
factory(): Promise<
|
|
14
|
-
WBTC(): Promise<
|
|
5
|
+
addLiquidity(tokenA: Address, tokenB: Address, amountADesired: bigint, amountBDesired: bigint, amountAMin: bigint, amountBMin: bigint, to: Address, deadline: bigint): Promise<CallResult>;
|
|
6
|
+
removeLiquidity(tokenA: Address, tokenB: Address, liquidity: bigint, amountAMin: bigint, amountBMin: bigint, to: Address, deadline: bigint): Promise<CallResult>;
|
|
7
|
+
quote(amountA: bigint, reserveA: bigint, reserveB: bigint): Promise<CallResult>;
|
|
8
|
+
getAmountOut(amountIn: bigint, reserveIn: bigint, reserveOut: bigint): Promise<CallResult>;
|
|
9
|
+
getAmountIn(amountOut: bigint, reserveIn: bigint, reserveOut: bigint): Promise<CallResult>;
|
|
10
|
+
getAmountsOut(amountIn: bigint, path: Address[]): Promise<CallResult>;
|
|
11
|
+
getAmountsIn(amountOut: bigint, path: Address[]): Promise<CallResult>;
|
|
12
|
+
swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: bigint, amountOutMin: bigint, path: Address[], to: Address, deadline: bigint): Promise<CallResult>;
|
|
13
|
+
factory(): Promise<CallResult>;
|
|
14
|
+
WBTC(): Promise<CallResult>;
|
|
15
15
|
}
|
|
@@ -1,16 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Address, AddressMap } from '@btc-vision/transaction';
|
|
2
|
+
import { CallResult } from '../../../contracts/CallResult.js';
|
|
3
3
|
import { IOP_NETContract } from './IOP_NETContract.js';
|
|
4
|
+
export type Name = CallResult<{
|
|
5
|
+
name: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type BalanceOf = CallResult<{
|
|
8
|
+
balance: bigint;
|
|
9
|
+
}>;
|
|
10
|
+
export type SymbolOf = CallResult<{
|
|
11
|
+
symbol: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type TotalSupply = CallResult<{
|
|
14
|
+
totalSupply: bigint;
|
|
15
|
+
}>;
|
|
16
|
+
export type MaxSupply = CallResult<{
|
|
17
|
+
maxSupply: bigint;
|
|
18
|
+
}>;
|
|
19
|
+
export type Decimals = CallResult<{
|
|
20
|
+
decimals: bigint;
|
|
21
|
+
}>;
|
|
22
|
+
export type Transfer = CallResult<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
export type TransferFrom = CallResult<{
|
|
26
|
+
success: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
export type Approve = CallResult<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
export type Allowance = CallResult<{
|
|
32
|
+
allowance: bigint;
|
|
33
|
+
}>;
|
|
34
|
+
export type Burn = CallResult<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export type Mint = CallResult<{
|
|
38
|
+
success: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
export type Airdrop = CallResult<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
export type AirdropWithAmount = CallResult<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
}>;
|
|
4
46
|
export interface IOP_20Contract extends IOP_NETContract {
|
|
5
|
-
balanceOf(
|
|
6
|
-
name(): Promise<
|
|
7
|
-
symbol(): Promise<
|
|
8
|
-
totalSupply(): Promise<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
burn(
|
|
47
|
+
balanceOf(account: Address): Promise<BalanceOf>;
|
|
48
|
+
name(): Promise<Name>;
|
|
49
|
+
symbol(): Promise<SymbolOf>;
|
|
50
|
+
totalSupply(): Promise<TotalSupply>;
|
|
51
|
+
maxSupply(): Promise<MaxSupply>;
|
|
52
|
+
decimals(): Promise<Decimals>;
|
|
53
|
+
transfer(recipient: Address, amount: bigint): Promise<Transfer>;
|
|
54
|
+
transferFrom(sender: Address, recipient: Address, amount: bigint): Promise<TransferFrom>;
|
|
55
|
+
approve(spender: Address, amount: bigint): Promise<Approve>;
|
|
56
|
+
allowance(owner: Address, spender: Address): Promise<Allowance>;
|
|
57
|
+
burn(value: bigint): Promise<Burn>;
|
|
58
|
+
mint(value: bigint): Promise<Mint>;
|
|
59
|
+
airdrop(tuple: AddressMap<bigint>): Promise<Airdrop>;
|
|
60
|
+
airdropWithAmount(amount: bigint, addresses: Address[]): Promise<AirdropWithAmount>;
|
|
16
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
import { CallResult } from '../../../contracts/CallResult.js';
|
|
3
3
|
import { BaseContractProperties } from '../../interfaces/BaseContractProperties.js';
|
|
4
4
|
export interface IOP_NETContract extends BaseContractProperties {
|
|
5
|
-
owner(): Promise<
|
|
6
|
-
isAddressOwner(address:
|
|
5
|
+
owner(): Promise<CallResult>;
|
|
6
|
+
isAddressOwner(address: Address): Promise<CallResult>;
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address } from '@btc-vision/
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
import { BaseContractProperties } from '../../interfaces/BaseContractProperties.js';
|
|
3
3
|
export interface IStackingContract {
|
|
4
4
|
stake(amount: bigint): Promise<BaseContractProperties>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CallResult } from '../../../contracts/CallResult.js';
|
|
2
2
|
import { IOP_20Contract } from './IOP_20Contract.js';
|
|
3
3
|
import { IStackingContract } from './IStackingContract.js';
|
|
4
4
|
export type MergedOP_20AndStackingContract = IOP_20Contract & IStackingContract;
|
|
5
5
|
export interface IWBTCContract extends MergedOP_20AndStackingContract {
|
|
6
|
-
requestWithdrawal(amount: bigint): Promise<
|
|
7
|
-
withdrawableBalanceOf(address: string): Promise<
|
|
6
|
+
requestWithdrawal(amount: bigint): Promise<CallResult>;
|
|
7
|
+
withdrawableBalanceOf(address: string): Promise<CallResult>;
|
|
8
8
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Address } from '@btc-vision/
|
|
2
|
-
import { BitcoinAddress } from '../bitcoin/BitcoinAddress.js';
|
|
3
|
-
export type BitcoinAddressLike = string | BitcoinAddress;
|
|
1
|
+
import { Address, AddressMap } from '@btc-vision/transaction';
|
|
4
2
|
export type PointerLike = bigint | string;
|
|
5
|
-
export type DecodedCallResult = bigint | string | boolean | number | Uint8Array | Array<bigint> | Array<string> | Array<boolean> | Array<number> | Array<Uint8Array> |
|
|
3
|
+
export type DecodedCallResult = bigint | string | boolean | number | Address | Uint8Array | Array<bigint> | Array<string> | Array<boolean> | Array<number> | Array<Uint8Array> | AddressMap<bigint>;
|
|
6
4
|
export type Numeric = number | bigint;
|
|
7
5
|
export type BigNumberish = Numeric | string;
|
|
8
6
|
export type BlockTag = BigNumberish | string;
|
|
@@ -1,19 +1,45 @@
|
|
|
1
|
-
import { BinaryReader,
|
|
1
|
+
import { BinaryReader, UTXO } from '@btc-vision/transaction';
|
|
2
|
+
import { Network, Signer } from 'bitcoinjs-lib';
|
|
3
|
+
import { ECPairInterface } from 'ecpair';
|
|
2
4
|
import { DecodedCallResult } from '../common/CommonTypes.js';
|
|
5
|
+
import { AbstractRpcProvider } from '../providers/AbstractRpcProvider.js';
|
|
3
6
|
import { ContractDecodedObjectResult, DecodedOutput } from './Contract.js';
|
|
4
7
|
import { IAccessList } from './interfaces/IAccessList.js';
|
|
5
|
-
import { ICallResultData } from './interfaces/ICallResult.js';
|
|
6
|
-
|
|
8
|
+
import { EventList, ICallResultData } from './interfaces/ICallResult.js';
|
|
9
|
+
import { OPNetEvent } from './OPNetEvent.js';
|
|
10
|
+
export interface TransactionParameters {
|
|
11
|
+
readonly signer: Signer | ECPairInterface;
|
|
12
|
+
readonly refundTo: string;
|
|
13
|
+
readonly priorityFee?: bigint;
|
|
14
|
+
readonly feeRate?: number;
|
|
15
|
+
readonly utxos?: UTXO[];
|
|
16
|
+
readonly maximumAllowedSatToSpend: bigint;
|
|
17
|
+
readonly network: Network;
|
|
18
|
+
}
|
|
19
|
+
export interface InteractionTransactionReceipt {
|
|
20
|
+
readonly transactionId: string;
|
|
21
|
+
readonly newUTXOs: UTXO[];
|
|
22
|
+
readonly peerAcknowledgements: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class CallResult<T extends ContractDecodedObjectResult = {}> implements Omit<ICallResultData, 'estimatedGas' | 'events'> {
|
|
25
|
+
#private;
|
|
7
26
|
readonly result: BinaryReader;
|
|
8
|
-
readonly events: NetEvent[];
|
|
9
27
|
readonly accessList: IAccessList;
|
|
10
28
|
readonly revert: string | undefined;
|
|
11
29
|
calldata: Buffer | undefined;
|
|
12
30
|
readonly estimatedGas: bigint | undefined;
|
|
13
31
|
readonly decoded: Array<DecodedCallResult>;
|
|
14
32
|
properties: T;
|
|
15
|
-
|
|
33
|
+
estimatedSatGas: bigint;
|
|
34
|
+
events: OPNetEvent[];
|
|
35
|
+
to: string | undefined;
|
|
36
|
+
constructor(callResult: ICallResultData, provider: AbstractRpcProvider);
|
|
37
|
+
get rawEvents(): EventList;
|
|
38
|
+
setTo(to: string): void;
|
|
39
|
+
sendTransaction(interactionParams: TransactionParameters): Promise<InteractionTransactionReceipt>;
|
|
40
|
+
setGasEstimation(estimatedGas: bigint): void;
|
|
16
41
|
setDecoded(decoded: DecodedOutput): void;
|
|
17
42
|
setCalldata(calldata: Buffer): void;
|
|
43
|
+
private parseEvents;
|
|
18
44
|
private base64ToUint8Array;
|
|
19
45
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Address, NetEvent } from '@btc-vision/
|
|
2
|
-
import {
|
|
1
|
+
import { Address, NetEvent } from '@btc-vision/transaction';
|
|
2
|
+
import { Network } from 'bitcoinjs-lib';
|
|
3
3
|
import { BitcoinInterface } from '../abi/BitcoinInterface.js';
|
|
4
4
|
import { BaseContractProperties } from '../abi/interfaces/BaseContractProperties.js';
|
|
5
5
|
import { BitcoinInterfaceAbi } from '../abi/interfaces/BitcoinInterfaceAbi.js';
|
|
6
|
-
import {
|
|
6
|
+
import { BlockGasParameters } from '../block/BlockGasParameters.js';
|
|
7
|
+
import { DecodedCallResult } from '../common/CommonTypes.js';
|
|
7
8
|
import { AbstractRpcProvider } from '../providers/AbstractRpcProvider.js';
|
|
8
9
|
import { ContractEvents } from '../transactions/interfaces/ITransactionReceipt.js';
|
|
10
|
+
import { CallResult } from './CallResult.js';
|
|
9
11
|
import { IContract } from './interfaces/IContract.js';
|
|
10
12
|
import { OPNetEvent } from './OPNetEvent.js';
|
|
11
13
|
declare const internal: unique symbol;
|
|
@@ -17,27 +19,34 @@ export type DecodedOutput = {
|
|
|
17
19
|
obj: ContractDecodedObjectResult;
|
|
18
20
|
};
|
|
19
21
|
export declare abstract class IBaseContract<T extends BaseContractProperties> implements IContract {
|
|
20
|
-
readonly address:
|
|
22
|
+
readonly address: string | Address;
|
|
23
|
+
readonly network: Network;
|
|
21
24
|
readonly interface: BitcoinInterface;
|
|
22
25
|
readonly provider: AbstractRpcProvider;
|
|
23
26
|
from?: Address;
|
|
24
27
|
readonly [internal]: keyof T | undefined;
|
|
25
28
|
private events;
|
|
26
|
-
|
|
29
|
+
private gasParameters;
|
|
30
|
+
private readonly fetchGasParametersAfter;
|
|
31
|
+
protected constructor(address: string | Address, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, network: Network, from?: Address);
|
|
32
|
+
get p2trOrTweaked(): string;
|
|
27
33
|
setSender(sender: Address): void;
|
|
28
34
|
decodeEvents(events: NetEvent[] | ContractEvents): OPNetEvent[];
|
|
29
35
|
decodeEvent(event: NetEvent): OPNetEvent;
|
|
30
36
|
encodeCalldata(functionName: string, args: unknown[]): Buffer;
|
|
31
|
-
|
|
37
|
+
currentGasParameters(): Promise<BlockGasParameters>;
|
|
38
|
+
protected getFunction(name: symbol | string): CallResult | undefined | string | number | symbol | Address | Network | (() => Promise<BlockGasParameters>) | ((functionName: string, args: unknown[]) => Buffer);
|
|
32
39
|
private defineInternalFunctions;
|
|
33
40
|
private encodeFunctionData;
|
|
34
41
|
private encodeInput;
|
|
35
42
|
private decodeOutput;
|
|
43
|
+
private estimateGas;
|
|
44
|
+
private max;
|
|
36
45
|
private callFunction;
|
|
37
46
|
}
|
|
38
47
|
export declare class BaseContract<T extends BaseContractProperties> extends IBaseContract<T> {
|
|
39
|
-
constructor(address:
|
|
48
|
+
constructor(address: string | Address, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, network: Network, sender?: Address);
|
|
40
49
|
private proxify;
|
|
41
50
|
}
|
|
42
|
-
export declare function getContract<T extends BaseContractProperties>(address:
|
|
51
|
+
export declare function getContract<T extends BaseContractProperties>(address: string | Address, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, network: Network, sender?: Address): BaseContract<T> & Omit<T, keyof BaseContract<T>>;
|
|
43
52
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetEvent } from '@btc-vision/
|
|
1
|
+
import { NetEvent } from '@btc-vision/transaction';
|
|
2
2
|
import { DecodedCallResult } from '../common/CommonTypes.js';
|
|
3
3
|
import { ContractDecodedObjectResult, DecodedOutput } from './Contract.js';
|
|
4
4
|
export interface IDecodedEvent extends NetEvent {
|
|
@@ -6,10 +6,9 @@ export interface IDecodedEvent extends NetEvent {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class OPNetEvent<T extends ContractDecodedObjectResult = {}> extends NetEvent implements IDecodedEvent {
|
|
8
8
|
readonly eventType: string;
|
|
9
|
-
readonly eventDataSelector: bigint;
|
|
10
9
|
readonly eventData: Uint8Array;
|
|
11
10
|
properties: T;
|
|
12
11
|
values: Array<DecodedCallResult>;
|
|
13
|
-
constructor(eventType: string,
|
|
12
|
+
constructor(eventType: string, eventData: Uint8Array);
|
|
14
13
|
setDecoded(decoded: DecodedOutput): void;
|
|
15
14
|
}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import { BinaryReader, NetEvent } from '@btc-vision/
|
|
1
|
+
import { BinaryReader, NetEvent } from '@btc-vision/transaction';
|
|
2
2
|
import { IAccessList } from './IAccessList.js';
|
|
3
3
|
export interface ICallRequestError {
|
|
4
4
|
readonly error: string;
|
|
5
5
|
}
|
|
6
|
+
export interface RawNetEvent {
|
|
7
|
+
readonly eventType: string;
|
|
8
|
+
readonly eventData: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RawEventList {
|
|
11
|
+
readonly [key: string]: RawNetEvent[];
|
|
12
|
+
}
|
|
13
|
+
export interface EventList {
|
|
14
|
+
[key: string]: NetEvent[];
|
|
15
|
+
}
|
|
6
16
|
export interface ICallResultData {
|
|
7
17
|
readonly result: string | BinaryReader;
|
|
8
|
-
readonly events:
|
|
18
|
+
readonly events: RawEventList;
|
|
9
19
|
readonly accessList: IAccessList;
|
|
10
20
|
readonly revert?: string;
|
|
11
21
|
readonly estimatedGas?: string;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { NetEvent } from '@btc-vision/
|
|
2
|
-
import {
|
|
1
|
+
import { Address, NetEvent } from '@btc-vision/transaction';
|
|
2
|
+
import { BlockGasParameters } from '../../block/BlockGasParameters.js';
|
|
3
3
|
import { ContractEvents } from '../../transactions/interfaces/ITransactionReceipt.js';
|
|
4
4
|
import { OPNetEvent } from '../OPNetEvent.js';
|
|
5
5
|
export interface IContract {
|
|
6
|
-
readonly address:
|
|
7
|
-
|
|
6
|
+
readonly address: Address | string;
|
|
7
|
+
get p2trOrTweaked(): string;
|
|
8
|
+
currentGasParameters(): Promise<BlockGasParameters>;
|
|
9
|
+
setSender(sender: Address): void;
|
|
8
10
|
decodeEvents(events: NetEvent[] | ContractEvents): OPNetEvent[];
|
|
9
11
|
decodeEvent(event: NetEvent): OPNetEvent;
|
|
10
12
|
encodeCalldata(method: string, ...args: unknown[]): Buffer;
|