opnet 1.1.2 → 1.1.3

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.
Files changed (55) hide show
  1. package/README.md +3 -2
  2. package/browser/_version.d.ts +1 -1
  3. package/browser/abi/shared/interfaces/IMotoswapFactoryContract.d.ts +7 -2
  4. package/browser/abi/shared/interfaces/IMotoswapPoolContract.d.ts +33 -7
  5. package/browser/abi/shared/interfaces/IMotoswapRouterContract.d.ts +30 -10
  6. package/browser/abi/shared/interfaces/IOP_20Contract.d.ts +1 -1
  7. package/browser/abi/shared/interfaces/IOP_NETContract.d.ts +3 -3
  8. package/browser/abi/shared/interfaces/IStackingContract.d.ts +22 -8
  9. package/browser/abi/shared/interfaces/IWBTCContract.d.ts +7 -2
  10. package/browser/index.js +1 -1
  11. package/browser/opnet.d.ts +0 -1
  12. package/browser/providers/AbstractRpcProvider.d.ts +6 -5
  13. package/browser/providers/JSONRpcProvider.d.ts +2 -1
  14. package/browser/providers/WebsocketRpcProvider.d.ts +2 -1
  15. package/build/_version.d.ts +1 -1
  16. package/build/_version.js +1 -1
  17. package/build/abi/shared/interfaces/IMotoswapFactoryContract.d.ts +7 -2
  18. package/build/abi/shared/interfaces/IMotoswapPoolContract.d.ts +33 -7
  19. package/build/abi/shared/interfaces/IMotoswapRouterContract.d.ts +30 -10
  20. package/build/abi/shared/interfaces/IOP_20Contract.d.ts +1 -1
  21. package/build/abi/shared/interfaces/IOP_NETContract.d.ts +3 -3
  22. package/build/abi/shared/interfaces/IStackingContract.d.ts +22 -8
  23. package/build/abi/shared/interfaces/IWBTCContract.d.ts +7 -2
  24. package/build/abi/shared/json/MOTOSWAP_FACTORY_ABI.js +1 -1
  25. package/build/abi/shared/json/MOTOSWAP_ROUTER_ABI.js +1 -12
  26. package/build/abi/shared/json/OP_NET_ABI.js +11 -0
  27. package/build/opnet.d.ts +0 -1
  28. package/build/opnet.js +0 -1
  29. package/build/providers/AbstractRpcProvider.d.ts +6 -5
  30. package/build/providers/AbstractRpcProvider.js +35 -20
  31. package/build/providers/JSONRpcProvider.d.ts +2 -1
  32. package/build/providers/JSONRpcProvider.js +2 -2
  33. package/build/providers/WebsocketRpcProvider.d.ts +2 -1
  34. package/build/providers/WebsocketRpcProvider.js +2 -2
  35. package/package.json +1 -1
  36. package/src/_version.ts +1 -1
  37. package/src/abi/shared/interfaces/IMotoswapFactoryContract.ts +7 -4
  38. package/src/abi/shared/interfaces/IMotoswapPoolContract.ts +40 -10
  39. package/src/abi/shared/interfaces/IMotoswapRouterContract.ts +21 -14
  40. package/src/abi/shared/interfaces/IOP_20Contract.ts +1 -1
  41. package/src/abi/shared/interfaces/IOP_NETContract.ts +1 -4
  42. package/src/abi/shared/interfaces/IStackingContract.ts +9 -9
  43. package/src/abi/shared/interfaces/IWBTCContract.ts +3 -2
  44. package/src/abi/shared/json/MOTOSWAP_FACTORY_ABI.ts +1 -1
  45. package/src/abi/shared/json/MOTOSWAP_ROUTER_ABI.ts +1 -12
  46. package/src/abi/shared/json/OP_NET_ABI.ts +12 -0
  47. package/src/opnet.ts +0 -1
  48. package/src/providers/AbstractRpcProvider.ts +56 -48
  49. package/src/providers/JSONRpcProvider.ts +3 -1
  50. package/src/providers/WebsocketRpcProvider.ts +3 -2
  51. package/src/providers/interfaces/PublicKeyInfo.d.ts +6 -0
  52. package/browser/abi/shared/json/MOTO_TOKEN_ABI.d.ts +0 -2
  53. package/build/abi/shared/json/MOTO_TOKEN_ABI.d.ts +0 -2
  54. package/build/abi/shared/json/MOTO_TOKEN_ABI.js +0 -22
  55. package/src/abi/shared/json/MOTO_TOKEN_ABI.ts +0 -29
package/README.md CHANGED
@@ -68,10 +68,11 @@ import { Configs } from '../configs/Configs.js';
68
68
  import { Address, Wallet } from '@btc-vision/transaction';
69
69
  import { Network } from 'bitcoinjs-lib';
70
70
 
71
- const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.org');
71
+ const network: Network = Configs.NETWORK;
72
+ const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.
73
+ org', network);
72
74
  const wallet: Wallet = Configs.WALLET;
73
75
  const yourAddress: Address = new Address(wallet.keypair.publicKey);
74
- const network: Network = Configs.NETWORK;
75
76
 
76
77
  const example: IOP_20Contract = getContract<IOP_20Contract>(
77
78
  'bcrt1plz0svv3wl05qrrv0dx8hvh5mgqc7jf3mhqgtw8jnj3l3d3cs6lzsfc3mxh',
@@ -1 +1 @@
1
- export declare const version = "1.1.2";
1
+ export declare const version = "1.1.3";
@@ -2,6 +2,11 @@ import { Address } from '@btc-vision/transaction';
2
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<CallResult>;
6
- createPool(token0: Address, token1: Address): Promise<CallResult>;
5
+ getPool(token0: Address, token1: Address): Promise<CallResult<{
6
+ pool: bigint;
7
+ }>>;
8
+ createPool(token0: Address, token1: Address): Promise<CallResult<{
9
+ pool: bigint;
10
+ address: Address;
11
+ }>>;
7
12
  }
@@ -1,13 +1,39 @@
1
1
  import { Address } from '@btc-vision/transaction';
2
2
  import { CallResult } from '../../../contracts/CallResult.js';
3
3
  import { IOP_20Contract } from './IOP_20Contract.js';
4
+ export type Reserves = {
5
+ readonly reserve0: bigint;
6
+ readonly reserve1: bigint;
7
+ readonly blockTimestampLast: bigint;
8
+ };
4
9
  export interface IMotoswapPoolContract extends Omit<IOP_20Contract, 'burn' | 'mint'> {
5
- token0(): Promise<CallResult>;
6
- token1(): Promise<CallResult>;
7
- getReserves(): Promise<CallResult>;
8
- swap(amount0Out: bigint, amount1Out: bigint, to: string, data: Uint8Array): Promise<CallResult>;
10
+ token0(): Promise<CallResult<{
11
+ token0: Address;
12
+ }>>;
13
+ token1(): Promise<CallResult<{
14
+ token1: Address;
15
+ }>>;
16
+ getReserves(): Promise<CallResult<Reserves>>;
17
+ swap(amount0Out: bigint, amount1Out: bigint, to: string, data: Uint8Array): Promise<CallResult<{
18
+ success: boolean;
19
+ }>>;
20
+ skim(): Promise<CallResult<{
21
+ success: boolean;
22
+ }>>;
23
+ kLast(): Promise<CallResult<{
24
+ kLast: bigint;
25
+ }>>;
9
26
  burn(to: Address): Promise<CallResult>;
10
- sync(): Promise<CallResult>;
11
- price0CumulativeLast(): Promise<CallResult>;
12
- price1CumulativeLast(): Promise<CallResult>;
27
+ blockTimestampLast(): Promise<CallResult<{
28
+ blockTimestampLast: bigint;
29
+ }>>;
30
+ sync(): Promise<CallResult<{
31
+ success: boolean;
32
+ }>>;
33
+ price0CumulativeLast(): Promise<CallResult<{
34
+ price0CumulativeLast: bigint;
35
+ }>>;
36
+ price1CumulativeLast(): Promise<CallResult<{
37
+ price1CumulativeLast: bigint;
38
+ }>>;
13
39
  }
@@ -2,14 +2,34 @@ import { Address } from '@btc-vision/transaction';
2
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<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>;
5
+ addLiquidity(tokenA: Address, tokenB: Address, amountADesired: bigint, amountBDesired: bigint, amountAMin: bigint, amountBMin: bigint, to: Address, deadline: bigint): Promise<CallResult<{
6
+ amountA: bigint;
7
+ amountB: bigint;
8
+ liquidity: bigint;
9
+ }>>;
10
+ removeLiquidity(tokenA: Address, tokenB: Address, liquidity: bigint, amountAMin: bigint, amountBMin: bigint, to: Address, deadline: bigint): Promise<CallResult<{
11
+ amountA: bigint;
12
+ amountB: bigint;
13
+ }>>;
14
+ quote(amountA: bigint, reserveA: bigint, reserveB: bigint): Promise<CallResult<{
15
+ quote: bigint;
16
+ }>>;
17
+ getAmountOut(amountIn: bigint, reserveIn: bigint, reserveOut: bigint): Promise<CallResult<{
18
+ amountOut: bigint;
19
+ }>>;
20
+ getAmountIn(amountOut: bigint, reserveIn: bigint, reserveOut: bigint): Promise<CallResult<{
21
+ amountIn: bigint;
22
+ }>>;
23
+ getAmountsOut(amountIn: bigint, path: Address[]): Promise<CallResult<{
24
+ amountsOut: bigint[];
25
+ }>>;
26
+ getAmountsIn(amountOut: bigint, path: Address[]): Promise<CallResult<{
27
+ amountsIn: bigint[];
28
+ }>>;
29
+ swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: bigint, amountOutMin: bigint, path: Address[], to: Address, deadline: bigint): Promise<CallResult<{
30
+ success: boolean;
31
+ }>>;
32
+ factory(): Promise<CallResult<{
33
+ factory: Address;
34
+ }>>;
15
35
  }
@@ -17,7 +17,7 @@ export type MaxSupply = CallResult<{
17
17
  maxSupply: bigint;
18
18
  }>;
19
19
  export type Decimals = CallResult<{
20
- decimals: bigint;
20
+ decimals: number;
21
21
  }>;
22
22
  export type Transfer = CallResult<{
23
23
  success: boolean;
@@ -1,7 +1,7 @@
1
- import { Address } from '@btc-vision/transaction';
2
1
  import { CallResult } from '../../../contracts/CallResult.js';
3
2
  import { BaseContractProperties } from '../../interfaces/BaseContractProperties.js';
4
3
  export interface IOP_NETContract extends BaseContractProperties {
5
- owner(): Promise<CallResult>;
6
- isAddressOwner(address: Address): Promise<CallResult>;
4
+ owner(): Promise<CallResult<{
5
+ owner: string;
6
+ }>>;
7
7
  }
@@ -1,11 +1,25 @@
1
1
  import { Address } from '@btc-vision/transaction';
2
- import { BaseContractProperties } from '../../interfaces/BaseContractProperties.js';
2
+ import { CallResult } from '../../../contracts/CallResult.js';
3
3
  export interface IStackingContract {
4
- stake(amount: bigint): Promise<BaseContractProperties>;
5
- unstake(): Promise<BaseContractProperties>;
6
- stakedAmount(address: Address): Promise<BaseContractProperties>;
7
- stakedReward(address: Address): Promise<BaseContractProperties>;
8
- claim(): Promise<BaseContractProperties>;
9
- rewardPool(): Promise<BaseContractProperties>;
10
- totalStaked(): Promise<BaseContractProperties>;
4
+ stake(amount: bigint): Promise<CallResult<{
5
+ success: boolean;
6
+ }>>;
7
+ unstake(): Promise<CallResult<{
8
+ success: boolean;
9
+ }>>;
10
+ stakedAmount(address: Address): Promise<CallResult<{
11
+ amount: bigint;
12
+ }>>;
13
+ stakedReward(address: Address): Promise<CallResult<{
14
+ amount: bigint;
15
+ }>>;
16
+ claim(): Promise<CallResult<{
17
+ success: boolean;
18
+ }>>;
19
+ rewardPool(): Promise<CallResult<{
20
+ reward: bigint;
21
+ }>>;
22
+ totalStaked(): Promise<CallResult<{
23
+ total: bigint;
24
+ }>>;
11
25
  }
@@ -1,8 +1,13 @@
1
+ import { Address } from '@btc-vision/transaction';
1
2
  import { CallResult } from '../../../contracts/CallResult.js';
2
3
  import { IOP_20Contract } from './IOP_20Contract.js';
3
4
  import { IStackingContract } from './IStackingContract.js';
4
5
  export type MergedOP_20AndStackingContract = IOP_20Contract & IStackingContract;
5
6
  export interface IWBTCContract extends MergedOP_20AndStackingContract {
6
- requestWithdrawal(amount: bigint): Promise<CallResult>;
7
- withdrawableBalanceOf(address: string): Promise<CallResult>;
7
+ requestWithdrawal(amount: bigint): Promise<CallResult<{
8
+ success: boolean;
9
+ }>>;
10
+ withdrawableBalanceOf(address: Address): Promise<CallResult<{
11
+ balance: bigint;
12
+ }>>;
8
13
  }