opnet 1.7.34 → 1.8.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.
Files changed (165) hide show
  1. package/README.md +88 -96
  2. package/browser/_version.d.ts +1 -1
  3. package/browser/abi/shared/interfaces/motoswap/IMotoChef.d.ts +5 -0
  4. package/browser/abi/shared/interfaces/motoswap/IMotoChefFactory.d.ts +98 -0
  5. package/browser/abi/shared/interfaces/motoswap/IOP20Factory.d.ts +76 -0
  6. package/browser/abi/shared/interfaces/motoswap/ITemplateMotoChef.d.ts +49 -0
  7. package/browser/abi/shared/interfaces/motoswap/ITemplateOP20.d.ts +71 -0
  8. package/browser/abi/shared/interfaces/opnet/IExtendedOP721Contract.d.ts +18 -10
  9. package/browser/abi/shared/interfaces/opnet/IOP20Contract.d.ts +57 -57
  10. package/browser/abi/shared/interfaces/opnet/IOP721Contract.d.ts +54 -43
  11. package/browser/abi/shared/interfaces/stable/IOracleCoinExample.d.ts +6 -0
  12. package/browser/abi/shared/interfaces/stable/IPeggedCoinExample.d.ts +11 -2
  13. package/browser/abi/shared/interfaces/stable/IStableCoinExample.d.ts +11 -2
  14. package/browser/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.d.ts +4 -0
  15. package/browser/abi/shared/json/motoswap/OP20_FACTORY_ABI.d.ts +4 -0
  16. package/browser/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.d.ts +3 -0
  17. package/browser/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.d.ts +4 -0
  18. package/browser/contracts/CallResult.d.ts +6 -2
  19. package/browser/contracts/CallResultSerializer.d.ts +42 -0
  20. package/browser/index.js +5138 -3316
  21. package/browser/noble-curves.js +5846 -3151
  22. package/browser/noble-hashes.js +3166 -2007
  23. package/browser/opnet.d.ts +1 -0
  24. package/browser/protobuf.js +606 -583
  25. package/browser/utxos/UTXOsManager.d.ts +3 -1
  26. package/browser/utxos/interfaces/IProviderForUTXO.d.ts +2 -1
  27. package/browser/utxos/interfaces/IUTXOsManager.d.ts +5 -0
  28. package/browser/valibot.js +5811 -4947
  29. package/browser/vendors.js +36218 -21116
  30. package/browser/worker_threads-browser.js +9 -7
  31. package/build/_version.d.ts +1 -1
  32. package/build/_version.js +1 -1
  33. package/build/abi/shared/interfaces/motoswap/IMotoChef.d.ts +5 -0
  34. package/build/abi/shared/interfaces/motoswap/IMotoChefFactory.d.ts +98 -0
  35. package/build/abi/shared/interfaces/motoswap/IMotoChefFactory.js +1 -0
  36. package/build/abi/shared/interfaces/motoswap/IOP20Factory.d.ts +76 -0
  37. package/build/abi/shared/interfaces/motoswap/IOP20Factory.js +1 -0
  38. package/build/abi/shared/interfaces/motoswap/ITemplateMotoChef.d.ts +49 -0
  39. package/build/abi/shared/interfaces/motoswap/ITemplateMotoChef.js +1 -0
  40. package/build/abi/shared/interfaces/motoswap/ITemplateOP20.d.ts +71 -0
  41. package/build/abi/shared/interfaces/motoswap/ITemplateOP20.js +1 -0
  42. package/build/abi/shared/interfaces/opnet/IExtendedOP721Contract.d.ts +18 -10
  43. package/build/abi/shared/interfaces/opnet/IOP20Contract.d.ts +57 -57
  44. package/build/abi/shared/interfaces/opnet/IOP721Contract.d.ts +54 -43
  45. package/build/abi/shared/interfaces/stable/IOracleCoinExample.d.ts +6 -0
  46. package/build/abi/shared/interfaces/stable/IPeggedCoinExample.d.ts +11 -2
  47. package/build/abi/shared/interfaces/stable/IStableCoinExample.d.ts +11 -2
  48. package/build/abi/shared/json/motoswap/MOTOCHEF_ABI.js +29 -1
  49. package/build/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.d.ts +4 -0
  50. package/build/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.js +187 -0
  51. package/build/abi/shared/json/motoswap/OP20_FACTORY_ABI.d.ts +4 -0
  52. package/build/abi/shared/json/motoswap/OP20_FACTORY_ABI.js +134 -0
  53. package/build/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.d.ts +3 -0
  54. package/build/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.js +139 -0
  55. package/build/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.d.ts +4 -0
  56. package/build/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.js +128 -0
  57. package/build/abi/shared/json/opnet/OP_20_ABI.js +125 -153
  58. package/build/abi/shared/json/opnet/OP_721_ABI.js +91 -102
  59. package/build/abi/shared/json/stable/ORACLE_COIN.js +17 -0
  60. package/build/abi/shared/json/stable/PEGGED_COIN.js +25 -0
  61. package/build/abi/shared/json/stable/STABLE_COIN.js +16 -0
  62. package/build/contracts/CallResult.d.ts +6 -2
  63. package/build/contracts/CallResult.js +122 -6
  64. package/build/contracts/CallResultSerializer.d.ts +42 -0
  65. package/build/contracts/CallResultSerializer.js +314 -0
  66. package/build/opnet.d.ts +1 -0
  67. package/build/opnet.js +1 -0
  68. package/build/tsconfig.build.tsbuildinfo +1 -0
  69. package/build/utxos/UTXOsManager.d.ts +3 -1
  70. package/build/utxos/UTXOsManager.js +117 -14
  71. package/build/utxos/interfaces/IProviderForUTXO.d.ts +2 -1
  72. package/build/utxos/interfaces/IUTXOsManager.d.ts +5 -0
  73. package/docs/README.md +405 -0
  74. package/docs/abi-reference/abi-overview.md +312 -0
  75. package/docs/abi-reference/custom-abis.md +416 -0
  76. package/docs/abi-reference/data-types.md +435 -0
  77. package/docs/abi-reference/factory-abis.md +381 -0
  78. package/docs/abi-reference/motoswap-abis.md +665 -0
  79. package/docs/abi-reference/op20-abi.md +364 -0
  80. package/docs/abi-reference/op20s-abi.md +365 -0
  81. package/docs/abi-reference/op721-abi.md +609 -0
  82. package/docs/abi-reference/stablecoin-abis.md +267 -0
  83. package/docs/api-reference/contract-api.md +443 -0
  84. package/docs/api-reference/epoch-api.md +323 -0
  85. package/docs/api-reference/provider-api.md +518 -0
  86. package/docs/api-reference/types-interfaces.md +599 -0
  87. package/docs/api-reference/utxo-manager-api.md +276 -0
  88. package/docs/bitcoin/balances.md +362 -0
  89. package/docs/bitcoin/sending-bitcoin.md +581 -0
  90. package/docs/bitcoin/utxo-optimization.md +772 -0
  91. package/docs/bitcoin/utxos.md +419 -0
  92. package/docs/blocks/block-operations.md +406 -0
  93. package/docs/blocks/block-witnesses.md +440 -0
  94. package/docs/blocks/gas-parameters.md +435 -0
  95. package/docs/blocks/reorg-detection.md +531 -0
  96. package/docs/contracts/contract-code.md +266 -0
  97. package/docs/contracts/gas-estimation.md +231 -0
  98. package/docs/contracts/instantiating-contracts.md +402 -0
  99. package/docs/contracts/offline-signing.md +389 -0
  100. package/docs/contracts/overview.md +357 -0
  101. package/docs/contracts/sending-transactions.md +524 -0
  102. package/docs/contracts/simulating-calls.md +659 -0
  103. package/docs/contracts/transaction-configuration.md +527 -0
  104. package/docs/epochs/epoch-operations.md +475 -0
  105. package/docs/epochs/mining-template.md +574 -0
  106. package/docs/epochs/overview.md +253 -0
  107. package/docs/epochs/submitting-epochs.md +694 -0
  108. package/docs/examples/advanced-swaps.md +951 -0
  109. package/docs/examples/deployment-examples.md +670 -0
  110. package/docs/examples/op20-examples.md +498 -0
  111. package/docs/examples/op721-examples.md +926 -0
  112. package/docs/getting-started/installation.md +331 -0
  113. package/docs/getting-started/overview.md +318 -0
  114. package/docs/getting-started/quick-start.md +513 -0
  115. package/docs/providers/advanced-configuration.md +489 -0
  116. package/docs/providers/internal-caching.md +262 -0
  117. package/docs/providers/json-rpc-provider.md +482 -0
  118. package/docs/providers/understanding-providers.md +297 -0
  119. package/docs/providers/websocket-provider.md +389 -0
  120. package/docs/public-keys/public-key-operations.md +485 -0
  121. package/docs/storage/storage-operations.md +556 -0
  122. package/docs/transactions/broadcasting.md +505 -0
  123. package/docs/transactions/challenges.md +433 -0
  124. package/docs/transactions/fetching-transactions.md +478 -0
  125. package/docs/transactions/transaction-receipts.md +490 -0
  126. package/docs/utils/binary-serialization.md +1075 -0
  127. package/docs/utils/bitcoin-utils.md +297 -0
  128. package/docs/utils/revert-decoder.md +463 -0
  129. package/package.json +12 -7
  130. package/src/_version.ts +1 -1
  131. package/src/abi/shared/interfaces/motoswap/IMotoChef.ts +17 -0
  132. package/src/abi/shared/interfaces/motoswap/IMotoChefFactory.ts +104 -0
  133. package/src/abi/shared/interfaces/motoswap/IOP20Factory.ts +72 -0
  134. package/src/abi/shared/interfaces/motoswap/ITemplateMotoChef.ts +63 -0
  135. package/src/abi/shared/interfaces/motoswap/ITemplateOP20.ts +79 -0
  136. package/src/abi/shared/interfaces/opnet/IExtendedOP721Contract.ts +18 -10
  137. package/src/abi/shared/interfaces/opnet/IOP20Contract.ts +174 -51
  138. package/src/abi/shared/interfaces/opnet/IOP721Contract.ts +96 -69
  139. package/src/abi/shared/interfaces/stable/IOracleCoinExample.ts +16 -1
  140. package/src/abi/shared/interfaces/stable/IPeggedCoinExample.ts +21 -2
  141. package/src/abi/shared/interfaces/stable/IStableCoinExample.ts +26 -7
  142. package/src/abi/shared/json/motoswap/MOTOCHEF_ABI.ts +29 -1
  143. package/src/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.ts +191 -0
  144. package/src/abi/shared/json/motoswap/OP20_FACTORY_ABI.ts +138 -0
  145. package/src/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.ts +150 -0
  146. package/src/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.ts +132 -0
  147. package/src/abi/shared/json/opnet/OP_20_ABI.ts +126 -156
  148. package/src/abi/shared/json/opnet/OP_721_ABI.ts +91 -104
  149. package/src/abi/shared/json/stable/ORACLE_COIN.ts +17 -0
  150. package/src/abi/shared/json/stable/PEGGED_COIN.ts +25 -0
  151. package/src/abi/shared/json/stable/STABLE_COIN.ts +16 -0
  152. package/src/contracts/CallResult.ts +204 -8
  153. package/src/contracts/CallResultSerializer.ts +458 -0
  154. package/src/opnet.ts +1 -0
  155. package/src/utxos/UTXOsManager.ts +192 -22
  156. package/src/utxos/interfaces/IProviderForUTXO.ts +2 -1
  157. package/src/utxos/interfaces/IUTXOsManager.ts +13 -0
  158. package/test/call-result-serializer.test.ts +1332 -0
  159. package/test/utxos-manager.test.ts +2012 -0
  160. package/tsconfig.build.json +5 -0
  161. package/tsconfig.json +2 -1
  162. package/vite.config.browser.ts +14 -4
  163. package/vitest.config.ts +22 -0
  164. package/build/tsconfig.tsbuildinfo +0 -1
  165. package/examples/UTXOManager.md +0 -418
package/README.md CHANGED
@@ -1,126 +1,118 @@
1
- # OP_NET - Smart Contracts on Bitcoin L1
1
+ # OPNet - Smart Contracts on Bitcoin L1
2
2
 
3
3
  ![Bitcoin](https://img.shields.io/badge/Bitcoin-000?style=for-the-badge&logo=bitcoin&logoColor=white)
4
4
  ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
5
5
  ![NodeJS](https://img.shields.io/badge/Node%20js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)
6
6
  ![NPM](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)
7
- ![Gulp](https://img.shields.io/badge/GULP-%23CF4647.svg?style=for-the-badge&logo=gulp&logoColor=white)
8
- ![ESLint](https://img.shields.io/badge/ESLint-4B3263?style=for-the-badge&logo=eslint&logoColor=white)
9
7
 
10
8
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
11
9
 
12
- ## Introduction
10
+ The official client library for building Bitcoin-based applications on OPNet. Full TypeScript support with type-safe contract interactions.
13
11
 
14
- A complete, compact and simple library for the Bitcoin ecosystem, written in
15
- TypeScript. This library is designed to be easy to use and understand, while
16
- providing a comprehensive set of functions for creating, reading and
17
- manipulating Bitcoin transactions. This library is designed to be able to
18
- manipulate anything related to BSI (Bitcoin Smart Inscription), smart contracts,
19
- and other Bitcoin-related technologies.
12
+ ## Installation
20
13
 
21
- ## Getting Started
22
-
23
- ### Prerequisites
24
-
25
- - Node.js version 16.x or higher
26
- - npm (Node Package Manager)
27
-
28
- ### Installation
29
-
30
- ```shell
31
- npm i opnet
14
+ ```bash
15
+ npm install opnet @btc-vision/transaction @btc-vision/bitcoin
32
16
  ```
33
17
 
34
- ### Documentation
18
+ ## Documentation
35
19
 
36
- Documentation available at [https://dev.opnet.org](https://dev.opnet.org) or in
37
- the `docs/` directory of the repository.
20
+ Check out the full documentation in [`/docs`](./docs)!
38
21
 
39
- #### Development
22
+ - [Getting Started](./docs/getting-started/quick-start.md)
23
+ - [Providers](./docs/providers/json-rpc-provider.md) - JSON-RPC & WebSocket connections
24
+ - [Smart Contracts](./docs/contracts/overview.md) - Contract interactions & transactions
25
+ - [UTXO Management](./docs/bitcoin/utxos.md) - Bitcoin UTXO handling
26
+ - [Offline Signing](./docs/contracts/offline-signing.md) - Cold wallet support
27
+ - [ABI Reference](./docs/abi-reference/abi-overview.md) - OP20, OP721, MotoSwap ABIs
28
+ - [API Reference](./docs/api-reference/provider-api.md) - Full API documentation
40
29
 
41
- 1. Clone the repository:
42
- ```bash
43
- git clone https://github.com/btc-vision/opnet.git
44
- ```
45
- 2. Navigate to the repository directory:
46
- ```bash
47
- cd opnet
48
- ```
49
- 3. Install the required dependencies:
50
- ```bash
51
- npm i
52
- ```
30
+ ## RPC Endpoints
53
31
 
54
- ## Example
32
+ | Network | URL |
33
+ |---------|-----|
34
+ | Mainnet | `https://mainnet.opnet.org` |
35
+ | Regtest | `https://regtest.opnet.org` |
55
36
 
56
- Calling a contract function from typescript/javascript is as simple as a few
57
- lines of code:
37
+ ## Quick Start
58
38
 
59
39
  ```typescript
60
- import {
61
- getContract,
62
- IOP20Contract,
63
- JSONRpcProvider,
64
- OP_20_ABI,
65
- TransactionParameters,
66
- } from 'opnet';
67
- import { Configs } from '../configs/Configs.js';
68
- import { Address, Wallet } from '@btc-vision/transaction';
69
- import { Network } from '@btc-vision/bitcoin';
70
-
71
- const network: Network = Configs.NETWORK;
72
- const provider: JSONRpcProvider = new JSONRpcProvider('https://regtest.opnet.org', network);
73
- const wallet: Wallet = Configs.WALLET;
74
- const yourAddress: Address = new Address(wallet.keypair.publicKey);
75
-
76
- const example: IOP20Contract = getContract<IOP20Contract>(
77
- 'bcrt1plz0svv3wl05qrrv0dx8hvh5mgqc7jf3mhqgtw8jnj3l3d3cs6lzsfc3mxh',
40
+ import { BitcoinUtils, getContract, IOP20Contract, JSONRpcProvider, OP_20_ABI } from 'opnet';
41
+ import { AddressTypes, Mnemonic, MLDSASecurityLevel } from '@btc-vision/transaction';
42
+ import { networks } from '@btc-vision/bitcoin';
43
+
44
+ // Connect to OPNet
45
+ const provider = new JSONRpcProvider('https://regtest.opnet.org', networks.regtest);
46
+
47
+ // Create wallet from mnemonic
48
+ const mnemonic = new Mnemonic(
49
+ 'your twenty four word seed phrase goes here ...',
50
+ '',
51
+ networks.regtest,
52
+ MLDSASecurityLevel.LEVEL2,
53
+ );
54
+ const wallet = mnemonic.deriveUnisat(AddressTypes.P2TR, 0);
55
+ const myAddress = wallet.address;
56
+
57
+ // Interact with a token contract
58
+ const token = getContract<IOP20Contract>(
59
+ 'op1...', // contract address
78
60
  OP_20_ABI,
79
61
  provider,
80
- Configs.NETWORK,
81
- yourAddress,
62
+ networks.regtest,
63
+ myAddress
82
64
  );
83
65
 
84
- const name = await example.name();
85
- const symbol = await example.symbol();
86
- const totalSupply = await example.totalSupply();
87
- const decimals = await example.decimals();
88
- const myBalance = await example.balanceOf(yourAddress);
89
-
90
- console.log('Name:', name.properties.name);
91
- console.log('Symbol:', symbol.properties.symbol);
92
- console.log('Total Supply:', totalSupply.properties.totalSupply);
93
- console.log('Decimals:', decimals.properties.decimals);
94
- console.log('My Balance:', myBalance.properties.balance);
95
-
96
- // You can also easily simulate & interact onchain!
97
-
98
- const transferSimulation = await example.transfer(yourAddress, 10000n);
99
- const params: TransactionParameters = {
100
- signer: wallet.keypair, // The keypair that will sign the transaction
101
- refundTo: wallet.p2tr, // Refund the rest of the funds to this address
102
- maximumAllowedSatToSpend: 5000n, // The maximum we want to allocate to this transaction in satoshis
103
- feeRate: 10, // We need to provide a fee rate
104
- network: network, // The network we are operating on
105
- };
106
-
107
- const tx = await transferSimulation.sendTransaction(params);
108
- console.log('Transaction created!', tx);
66
+ // Read token info
67
+ const name = await token.name();
68
+ const balance = await token.balanceOf(myAddress);
69
+
70
+ console.log('Token:', name.properties.name);
71
+ console.log('Balance:', balance.properties.balance);
72
+
73
+ // Send a transaction (100 tokens with 8 decimals)
74
+ const amount = BitcoinUtils.expandToDecimals(100, 8);
75
+ const simulation = await token.transfer(recipientAddress, amount);
76
+
77
+ if (simulation.revert) {
78
+ throw new Error(`Transfer would fail: ${simulation.revert}`);
79
+ }
80
+
81
+ const tx = await simulation.sendTransaction({
82
+ signer: wallet.keypair,
83
+ mldsaSigner: wallet.mldsaKeypair,
84
+ refundTo: wallet.p2tr,
85
+ maximumAllowedSatToSpend: 50000n,
86
+ feeRate: 10,
87
+ network: networks.regtest,
88
+ });
89
+
90
+ console.log('TX ID:', tx.transactionId);
109
91
  ```
110
92
 
111
- You can get the calldata generated by doing balanceExample.calldata and generate
112
- your transaction based on that. In scenarios where you are writing data
113
- on-chain, you must specify the sender in the getContract function. This is
114
- important for the simulation to pass.
93
+ ## Requirements
94
+
95
+ - Node.js >= 24.0.0
96
+ - TypeScript >= 5.9
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ git clone https://github.com/btc-vision/opnet.git
102
+ cd opnet
103
+ npm install
104
+ npm run build
105
+ ```
106
+
107
+ ## Links
108
+
109
+ - [OPNet Website](https://opnet.org)
110
+ - [GitHub](https://github.com/btc-vision/opnet)
115
111
 
116
- ## Contribution
112
+ ## Contributing
117
113
 
118
- Contributions are welcome! Please read through the `CONTRIBUTING.md` file for
119
- guidelines on how to submit issues, feature requests, and pull requests. We
120
- appreciate your input and encourage you to help us improve OP_NET.
114
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
121
115
 
122
116
  ## License
123
117
 
124
- This project is open source and available under the
125
- [Apache-2.0 License](LICENSE). If you have any suggestions or contributions,
126
- please feel free to submit a pull request.
118
+ [Apache-2.0](LICENSE)
@@ -1 +1 @@
1
- export declare const version = "1.7.34";
1
+ export declare const version = "1.8.0";
@@ -144,6 +144,10 @@ export type SetMotoPerBlock = CallResult<{}, OPNetEvent<never>[]>;
144
144
  export type SetBonusEndBlock = CallResult<{}, OPNetEvent<never>[]>;
145
145
  export type SetBonusMultiplier = CallResult<{}, OPNetEvent<never>[]>;
146
146
  export type SetDev = CallResult<{}, OPNetEvent<never>[]>;
147
+ export type OnOP20Received = CallResult<{
148
+ selector: Buffer;
149
+ }, [
150
+ ]>;
147
151
  export interface IMotoChef extends IOwnable {
148
152
  initialize(motoAddress: Address, premineAmount: bigint, devAddress: Address, motoPerBlock: bigint, bonusEndBlock: bigint, bonusMultiplier: bigint, treasuryAddress: string, BTCAllocPoint: bigint, MOTOAllocPoint: bigint): Promise<Initialize>;
149
153
  totalAllocPoint(): Promise<TotalAllocPoint>;
@@ -178,5 +182,6 @@ export interface IMotoChef extends IOwnable {
178
182
  setBonusEndBlock(bonusEndBlock: bigint): Promise<SetBonusEndBlock>;
179
183
  setBonusMultiplier(bonusMultiplier: bigint): Promise<SetBonusMultiplier>;
180
184
  setDev(devAddress: Address): Promise<SetDev>;
185
+ onOP20Received(operator: Address, from: Address, amount: bigint, data: Uint8Array): Promise<OnOP20Received>;
181
186
  }
182
187
  export {};
@@ -0,0 +1,98 @@
1
+ import { Address } from '../../../../../node_modules/@btc-vision/transaction/build/index.js';
2
+ import { CallResult } from '../../../../contracts/CallResult.js';
3
+ import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
4
+ import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
5
+ export type TokenDeployedEvent = {
6
+ readonly deployer: Address;
7
+ readonly token: Address;
8
+ readonly name: string;
9
+ readonly symbol: string;
10
+ };
11
+ export type MotoChefDeployedEvent = {
12
+ readonly deployer: Address;
13
+ readonly token: Address;
14
+ readonly motoChef: Address;
15
+ readonly userBTCFeePercentage: bigint;
16
+ readonly farmName: string;
17
+ };
18
+ export type FactoryPausedEvent = {
19
+ readonly by: Address;
20
+ };
21
+ export type FactoryUnpausedEvent = {
22
+ readonly by: Address;
23
+ };
24
+ export type InitializeFactory = CallResult<{
25
+ success: boolean;
26
+ }, []>;
27
+ export type Owner = CallResult<{
28
+ owner: Address;
29
+ }, []>;
30
+ export type PauseFactory = CallResult<{
31
+ success: boolean;
32
+ }, [OPNetEvent<FactoryPausedEvent>]>;
33
+ export type UnpauseFactory = CallResult<{
34
+ success: boolean;
35
+ }, [OPNetEvent<FactoryUnpausedEvent>]>;
36
+ export type IsPaused = CallResult<{
37
+ isPaused: boolean;
38
+ }, []>;
39
+ export type GetTokenDeployer = CallResult<{
40
+ deployer: Address;
41
+ }, []>;
42
+ export type GetTokenOwner = CallResult<{
43
+ owner: Address;
44
+ }, []>;
45
+ export type DeployToken = CallResult<{
46
+ success: boolean;
47
+ }, [OPNetEvent<TokenDeployedEvent>]>;
48
+ export type DeployMotoChef = CallResult<{
49
+ success: boolean;
50
+ }, [OPNetEvent<MotoChefDeployedEvent>]>;
51
+ export type UpdateTokenOwner = CallResult<{
52
+ success: boolean;
53
+ }, []>;
54
+ export type GetUserTokens = CallResult<{
55
+ tokens: Buffer;
56
+ }, []>;
57
+ export type GetDeploymentInfo = CallResult<{
58
+ has: boolean;
59
+ token: Address;
60
+ motoChef: Address;
61
+ block: bigint;
62
+ }, [
63
+ ]>;
64
+ export type GetDeploymentsCount = CallResult<{
65
+ count: number;
66
+ }, []>;
67
+ export type GetDeploymentByIndex = CallResult<{
68
+ deployer: Address;
69
+ token: Address;
70
+ motoChef: Address;
71
+ block: bigint;
72
+ }, [
73
+ ]>;
74
+ export type GetTokenMotoChef = CallResult<{
75
+ motoChefAddress: Address;
76
+ }, []>;
77
+ export type OnOP20Received = CallResult<{
78
+ selector: Buffer;
79
+ }, []>;
80
+ export interface IMotoChefFactory extends IOP_NETContract {
81
+ owner(): Promise<Owner>;
82
+ initialize(motoTokenAddress: Address): Promise<InitializeFactory>;
83
+ pauseFactory(): Promise<PauseFactory>;
84
+ unpauseFactory(): Promise<UnpauseFactory>;
85
+ isPaused(): Promise<IsPaused>;
86
+ getTokenDeployer(tokenAddress: Address): Promise<GetTokenDeployer>;
87
+ getTokenOwner(tokenAddress: Address): Promise<GetTokenOwner>;
88
+ deployToken(maxSupply: bigint, decimals: number, name: string, symbol: string, initialMintTo: Address, initialMintAmount: bigint, freeMintSupply: bigint, freeMintPerTx: bigint, tokenOwner: Address): Promise<DeployToken>;
89
+ deployMotoChef(devAddress: Address, tokenPerBlock: bigint, bonusEndBlock: bigint, bonusMultiplier: bigint, BTCAllocPoint: bigint, tokenAddress: Address, tokenAllocPoint: bigint, userBTCFeePercentage: bigint, userFeeRecipient: string, farmName: string, farmBanner: string, additionalPoolTokens: Address[], additionalPoolAllocPoints: bigint[]): Promise<DeployMotoChef>;
90
+ updateTokenOwner(tokenAddress: Address, newOwner: Address): Promise<UpdateTokenOwner>;
91
+ getUserTokens(deployer: Address): Promise<GetUserTokens>;
92
+ getDeploymentInfo(deployer: Address): Promise<GetDeploymentInfo>;
93
+ getDeploymentsCount(): Promise<GetDeploymentsCount>;
94
+ getDeploymentByIndex(index: number): Promise<GetDeploymentByIndex>;
95
+ getTokenMotoChef(tokenAddress: Address): Promise<GetTokenMotoChef>;
96
+ onOP20Received(operator: Address, from: Address, amount: bigint, data: Buffer): Promise<OnOP20Received>;
97
+ }
98
+ export default IMotoChefFactory;
@@ -0,0 +1,76 @@
1
+ import { Address } from '../../../../../node_modules/@btc-vision/transaction/build/index.js';
2
+ import { CallResult } from '../../../../contracts/CallResult.js';
3
+ import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
4
+ import { IOP_NETContract } from '../opnet/IOP_NETContract.js';
5
+ export type TokenDeployedEvent = {
6
+ readonly deployer: Address;
7
+ readonly token: Address;
8
+ readonly name: string;
9
+ readonly symbol: string;
10
+ };
11
+ export type FactoryPausedEvent = {
12
+ readonly by: Address;
13
+ };
14
+ export type FactoryUnpausedEvent = {
15
+ readonly by: Address;
16
+ };
17
+ export type Owner = CallResult<{
18
+ owner: Address;
19
+ }, []>;
20
+ export type PauseFactory = CallResult<{
21
+ success: boolean;
22
+ }, [OPNetEvent<FactoryPausedEvent>]>;
23
+ export type UnpauseFactory = CallResult<{
24
+ success: boolean;
25
+ }, [OPNetEvent<FactoryUnpausedEvent>]>;
26
+ export type IsPaused = CallResult<{
27
+ isPaused: boolean;
28
+ }, []>;
29
+ export type GetTokenDeployer = CallResult<{
30
+ deployer: Address;
31
+ }, []>;
32
+ export type GetTokenOwner = CallResult<{
33
+ owner: Address;
34
+ }, []>;
35
+ export type DeployToken = CallResult<{
36
+ success: boolean;
37
+ }, [OPNetEvent<TokenDeployedEvent>]>;
38
+ export type UpdateTokenOwner = CallResult<{
39
+ success: boolean;
40
+ }, []>;
41
+ export type GetUserTokens = CallResult<{
42
+ tokens: Buffer;
43
+ }, []>;
44
+ export type GetDeploymentInfo = CallResult<{
45
+ has: boolean;
46
+ token: Address;
47
+ block: bigint;
48
+ }, []>;
49
+ export type GetDeploymentsCount = CallResult<{
50
+ count: number;
51
+ }, []>;
52
+ export type GetDeploymentByIndex = CallResult<{
53
+ deployer: Address;
54
+ token: Address;
55
+ block: bigint;
56
+ }, [
57
+ ]>;
58
+ export type OnOP20Received = CallResult<{
59
+ selector: Buffer;
60
+ }, []>;
61
+ export interface IOP20Factory extends IOP_NETContract {
62
+ owner(): Promise<Owner>;
63
+ pauseFactory(): Promise<PauseFactory>;
64
+ unpauseFactory(): Promise<UnpauseFactory>;
65
+ isPaused(): Promise<IsPaused>;
66
+ getTokenDeployer(tokenAddress: Address): Promise<GetTokenDeployer>;
67
+ getTokenOwner(tokenAddress: Address): Promise<GetTokenOwner>;
68
+ deployToken(maxSupply: bigint, decimals: number, name: string, symbol: string, initialMintTo: Address, initialMintAmount: bigint, freeMintSupply: bigint, freeMintPerTx: bigint, tokenOwner: Address): Promise<DeployToken>;
69
+ updateTokenOwner(tokenAddress: Address, newOwner: Address): Promise<UpdateTokenOwner>;
70
+ getUserTokens(deployer: Address): Promise<GetUserTokens>;
71
+ getDeploymentInfo(deployer: Address): Promise<GetDeploymentInfo>;
72
+ getDeploymentsCount(): Promise<GetDeploymentsCount>;
73
+ getDeploymentByIndex(index: number): Promise<GetDeploymentByIndex>;
74
+ onOP20Received(operator: Address, from: Address, amount: bigint, data: Buffer): Promise<OnOP20Received>;
75
+ }
76
+ export default IOP20Factory;
@@ -0,0 +1,49 @@
1
+ import { Address } from '../../../../../node_modules/@btc-vision/transaction/build/index.js';
2
+ import { CallResult } from '../../../../contracts/CallResult.js';
3
+ import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
4
+ import { IMotoChef, InitializedEvent, PoolAddedEvent } from './IMotoChef.js';
5
+ export type TemplateMotoChefInitializedEvent = {};
6
+ export type TemplateMotoChefInitialize = CallResult<{}, OPNetEvent<PoolAddedEvent | InitializedEvent>[]>;
7
+ export type GetFarmName = CallResult<{
8
+ name: string;
9
+ }, OPNetEvent<never>[]>;
10
+ export type GetFarmBanner = CallResult<{
11
+ banner: string;
12
+ }, OPNetEvent<never>[]>;
13
+ export type SetUserTokenAddress = CallResult<{}, OPNetEvent<never>[]>;
14
+ export type TransferOwnershipToUser = CallResult<{}, OPNetEvent<never>[]>;
15
+ export type UserFeeRecipient = CallResult<{
16
+ recipient: string;
17
+ }, OPNetEvent<never>[]>;
18
+ export type MotoSwapFeeRecipient = CallResult<{
19
+ recipient: string;
20
+ }, OPNetEvent<never>[]>;
21
+ export type OpnetFeeRecipient = CallResult<{
22
+ recipient: string;
23
+ }, OPNetEvent<never>[]>;
24
+ export type BtcFeePercentage = CallResult<{
25
+ percentage: bigint;
26
+ }, OPNetEvent<never>[]>;
27
+ export type GetFeeDistributionBps = CallResult<{
28
+ userFeeBps: bigint;
29
+ motoSwapFeeBps: bigint;
30
+ opnetFeeBps: bigint;
31
+ totalBps: bigint;
32
+ }, OPNetEvent<never>[]>;
33
+ export type TotalUserTokenStaked = CallResult<{
34
+ totalStaked: bigint;
35
+ }, OPNetEvent<never>[]>;
36
+ export interface ITemplateMotoChef extends Omit<IMotoChef, 'initialize'> {
37
+ initialize(userTokenAddress: Address, devAddress: Address, tokenPerBlock: bigint, bonusEndBlock: bigint, bonusMultiplier: bigint, BTCAllocPoint: bigint, lpTokenAddress: Address, tokenAllocPoint: bigint, userBTCFeePercentage: bigint, userFeeRecipient: string, motoSwapFeeRecipient: string, opnetFeeRecipient: string, farmName: string, farmBanner: string, additionalPoolTokens: Address[], additionalPoolAllocPoints: bigint[]): Promise<TemplateMotoChefInitialize>;
38
+ getFarmName(): Promise<GetFarmName>;
39
+ getFarmBanner(): Promise<GetFarmBanner>;
40
+ setUserTokenAddress(tokenAddress: Address): Promise<SetUserTokenAddress>;
41
+ transferOwnershipToUser(newOwner: Address): Promise<TransferOwnershipToUser>;
42
+ userFeeRecipient(): Promise<UserFeeRecipient>;
43
+ motoSwapFeeRecipient(): Promise<MotoSwapFeeRecipient>;
44
+ opnetFeeRecipient(): Promise<OpnetFeeRecipient>;
45
+ btcFeePercentage(): Promise<BtcFeePercentage>;
46
+ getFeeDistributionBps(): Promise<GetFeeDistributionBps>;
47
+ totalUserTokenStaked(): Promise<TotalUserTokenStaked>;
48
+ }
49
+ export default ITemplateMotoChef;
@@ -0,0 +1,71 @@
1
+ import { Address } from '../../../../../node_modules/@btc-vision/transaction/build/index.js';
2
+ import { CallResult } from '../../../../contracts/CallResult.js';
3
+ import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
4
+ import { IOP20Contract } from '../opnet/IOP20Contract.js';
5
+ export type MintedEvent = {
6
+ readonly to: Address;
7
+ readonly amount: bigint;
8
+ };
9
+ export type FreeMintConfiguredEvent = {
10
+ readonly token: Address;
11
+ readonly supply: bigint;
12
+ readonly perTxLimit: bigint;
13
+ };
14
+ export type FreeMintClaimedEvent = {
15
+ readonly user: Address;
16
+ readonly token: Address;
17
+ readonly amount: bigint;
18
+ };
19
+ export type TokenOwnerTransferredEvent = {
20
+ readonly previousOwner: Address;
21
+ readonly newOwner: Address;
22
+ };
23
+ export type TemplateOP20Initialize = CallResult<{}, OPNetEvent<MintedEvent | FreeMintConfiguredEvent>[]>;
24
+ export type TemplateOP20Mint = CallResult<{}, [OPNetEvent<MintedEvent>]>;
25
+ export type GrantMinterRole = CallResult<{
26
+ success: boolean;
27
+ }, []>;
28
+ export type RevokeMinterRole = CallResult<{
29
+ success: boolean;
30
+ }, []>;
31
+ export type IsMinter = CallResult<{
32
+ isMinter: boolean;
33
+ }, []>;
34
+ export type TokenOwner = CallResult<{
35
+ owner: Address;
36
+ }, []>;
37
+ export type FactoryAddress = CallResult<{
38
+ factory: Address;
39
+ }, []>;
40
+ export type TemplateOP20Deployer = CallResult<{
41
+ deployer: Address;
42
+ }, []>;
43
+ export type TransferTokenOwner = CallResult<{
44
+ success: boolean;
45
+ }, [
46
+ OPNetEvent<TokenOwnerTransferredEvent>
47
+ ]>;
48
+ export type FreeMint = CallResult<{
49
+ success: boolean;
50
+ }, [OPNetEvent<MintedEvent>]>;
51
+ export type FreeMintInfo = CallResult<{
52
+ info: Buffer;
53
+ }, []>;
54
+ export type OnOP20Received = CallResult<{
55
+ selector: Buffer;
56
+ }, []>;
57
+ export interface ITemplateOP20 extends IOP20Contract {
58
+ initialize(maxSupply: bigint, decimals: number, name: string, symbol: string, initialMintTo: Address, initialMintAmount: bigint, freeMintSupply: bigint, freeMintPerTx: bigint, tokenOwner: Address): Promise<TemplateOP20Initialize>;
59
+ mint(to: Address, amount: bigint): Promise<TemplateOP20Mint>;
60
+ grantMinterRole(minter: Address): Promise<GrantMinterRole>;
61
+ revokeMinterRole(minter: Address): Promise<RevokeMinterRole>;
62
+ isMinter(account: Address): Promise<IsMinter>;
63
+ getTokenOwner(): Promise<TokenOwner>;
64
+ getFactoryAddress(): Promise<FactoryAddress>;
65
+ deployer(): Promise<TemplateOP20Deployer>;
66
+ transferTokenOwner(newOwner: Address): Promise<TransferTokenOwner>;
67
+ freeMint(amount: bigint): Promise<FreeMint>;
68
+ getFreeMintInfo(): Promise<FreeMintInfo>;
69
+ onOP20Received(operator: Address, from: Address, amount: bigint, data: Buffer): Promise<OnOP20Received>;
70
+ }
71
+ export default ITemplateOP20;
@@ -1,7 +1,7 @@
1
1
  import { Address } from '../../../../../node_modules/@btc-vision/transaction/build/index.js';
2
2
  import { CallResult } from '../../../../contracts/CallResult.js';
3
3
  import { OPNetEvent } from '../../../../contracts/OPNetEvent.js';
4
- import { IOP721, TransferredEventNFT, URIEventNFT } from './IOP721Contract.js';
4
+ import { IOP721Contract, TransferredEventNFT, URIEventNFT } from './IOP721Contract.js';
5
5
  export type MintStatusChangedEventNFT = {
6
6
  readonly enabled: boolean;
7
7
  };
@@ -20,16 +20,22 @@ export type ReservationExpiredEventNFT = {
20
20
  readonly block: bigint;
21
21
  readonly amountRecovered: bigint;
22
22
  };
23
- export type SetMintEnabled = CallResult<{}, OPNetEvent<MintStatusChangedEventNFT>[]>;
23
+ export type SetMintEnabled = CallResult<{}, [OPNetEvent<MintStatusChangedEventNFT>]>;
24
24
  export type IsMintEnabled = CallResult<{
25
25
  enabled: boolean;
26
- }, OPNetEvent<never>[]>;
26
+ }, [
27
+ ]>;
27
28
  export type ReserveNFT = CallResult<{
28
29
  readonly remainingPayment: bigint;
29
30
  readonly reservationBlock: bigint;
30
- }, OPNetEvent<ReservationCreatedEventNFT>[]>;
31
- export type ClaimNFT = CallResult<{}, OPNetEvent<ReservationClaimedEventNFT | TransferredEventNFT>[]>;
32
- export type PurgeExpiredNFT = CallResult<{}, OPNetEvent<ReservationExpiredEventNFT>[]>;
31
+ }, [
32
+ OPNetEvent<ReservationCreatedEventNFT>
33
+ ]>;
34
+ export type ClaimNFT = CallResult<{}, [
35
+ OPNetEvent<ReservationClaimedEventNFT>,
36
+ ...OPNetEvent<TransferredEventNFT>[]
37
+ ]>;
38
+ export type PurgeExpiredNFT = CallResult<{}, [...OPNetEvent<ReservationExpiredEventNFT>[]]>;
33
39
  export type GetStatus = CallResult<{
34
40
  minted: bigint;
35
41
  reserved: bigint;
@@ -39,10 +45,11 @@ export type GetStatus = CallResult<{
39
45
  pricePerToken: bigint;
40
46
  reservationFeePercent: bigint;
41
47
  minReservationFee: bigint;
42
- }, OPNetEvent<never>[]>;
43
- export type AirdropNFT = CallResult<{}, OPNetEvent<TransferredEventNFT>[]>;
44
- export type SetTokenURI = CallResult<{}, OPNetEvent<URIEventNFT>[]>;
45
- export interface IExtendedOP721 extends IOP721 {
48
+ }, [
49
+ ]>;
50
+ export type AirdropNFT = CallResult<{}, [...OPNetEvent<TransferredEventNFT>[]]>;
51
+ export type SetTokenURI = CallResult<{}, [OPNetEvent<URIEventNFT>]>;
52
+ export interface IExtendedOP721Contract extends IOP721Contract {
46
53
  setMintEnabled(enabled: boolean): Promise<SetMintEnabled>;
47
54
  isMintEnabled(): Promise<IsMintEnabled>;
48
55
  airdrop(addresses: Address[], amounts: number[]): Promise<AirdropNFT>;
@@ -52,3 +59,4 @@ export interface IExtendedOP721 extends IOP721 {
52
59
  getStatus(): Promise<GetStatus>;
53
60
  setTokenURI(tokenId: bigint, uri: string): Promise<SetTokenURI>;
54
61
  }
62
+ export type IExtendedOP721 = IExtendedOP721Contract;