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.
- package/README.md +88 -96
- package/browser/_version.d.ts +1 -1
- package/browser/abi/shared/interfaces/motoswap/IMotoChef.d.ts +5 -0
- package/browser/abi/shared/interfaces/motoswap/IMotoChefFactory.d.ts +98 -0
- package/browser/abi/shared/interfaces/motoswap/IOP20Factory.d.ts +76 -0
- package/browser/abi/shared/interfaces/motoswap/ITemplateMotoChef.d.ts +49 -0
- package/browser/abi/shared/interfaces/motoswap/ITemplateOP20.d.ts +71 -0
- package/browser/abi/shared/interfaces/opnet/IExtendedOP721Contract.d.ts +18 -10
- package/browser/abi/shared/interfaces/opnet/IOP20Contract.d.ts +57 -57
- package/browser/abi/shared/interfaces/opnet/IOP721Contract.d.ts +54 -43
- package/browser/abi/shared/interfaces/stable/IOracleCoinExample.d.ts +6 -0
- package/browser/abi/shared/interfaces/stable/IPeggedCoinExample.d.ts +11 -2
- package/browser/abi/shared/interfaces/stable/IStableCoinExample.d.ts +11 -2
- package/browser/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.d.ts +4 -0
- package/browser/abi/shared/json/motoswap/OP20_FACTORY_ABI.d.ts +4 -0
- package/browser/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.d.ts +3 -0
- package/browser/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.d.ts +4 -0
- package/browser/contracts/CallResult.d.ts +6 -2
- package/browser/contracts/CallResultSerializer.d.ts +42 -0
- package/browser/index.js +5138 -3316
- package/browser/noble-curves.js +5846 -3151
- package/browser/noble-hashes.js +3166 -2007
- package/browser/opnet.d.ts +1 -0
- package/browser/protobuf.js +606 -583
- package/browser/utxos/UTXOsManager.d.ts +3 -1
- package/browser/utxos/interfaces/IProviderForUTXO.d.ts +2 -1
- package/browser/utxos/interfaces/IUTXOsManager.d.ts +5 -0
- package/browser/valibot.js +5811 -4947
- package/browser/vendors.js +36218 -21116
- package/browser/worker_threads-browser.js +9 -7
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/shared/interfaces/motoswap/IMotoChef.d.ts +5 -0
- package/build/abi/shared/interfaces/motoswap/IMotoChefFactory.d.ts +98 -0
- package/build/abi/shared/interfaces/motoswap/IMotoChefFactory.js +1 -0
- package/build/abi/shared/interfaces/motoswap/IOP20Factory.d.ts +76 -0
- package/build/abi/shared/interfaces/motoswap/IOP20Factory.js +1 -0
- package/build/abi/shared/interfaces/motoswap/ITemplateMotoChef.d.ts +49 -0
- package/build/abi/shared/interfaces/motoswap/ITemplateMotoChef.js +1 -0
- package/build/abi/shared/interfaces/motoswap/ITemplateOP20.d.ts +71 -0
- package/build/abi/shared/interfaces/motoswap/ITemplateOP20.js +1 -0
- package/build/abi/shared/interfaces/opnet/IExtendedOP721Contract.d.ts +18 -10
- package/build/abi/shared/interfaces/opnet/IOP20Contract.d.ts +57 -57
- package/build/abi/shared/interfaces/opnet/IOP721Contract.d.ts +54 -43
- package/build/abi/shared/interfaces/stable/IOracleCoinExample.d.ts +6 -0
- package/build/abi/shared/interfaces/stable/IPeggedCoinExample.d.ts +11 -2
- package/build/abi/shared/interfaces/stable/IStableCoinExample.d.ts +11 -2
- package/build/abi/shared/json/motoswap/MOTOCHEF_ABI.js +29 -1
- package/build/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.d.ts +4 -0
- package/build/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.js +187 -0
- package/build/abi/shared/json/motoswap/OP20_FACTORY_ABI.d.ts +4 -0
- package/build/abi/shared/json/motoswap/OP20_FACTORY_ABI.js +134 -0
- package/build/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.d.ts +3 -0
- package/build/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.js +139 -0
- package/build/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.d.ts +4 -0
- package/build/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.js +128 -0
- package/build/abi/shared/json/opnet/OP_20_ABI.js +125 -153
- package/build/abi/shared/json/opnet/OP_721_ABI.js +91 -102
- package/build/abi/shared/json/stable/ORACLE_COIN.js +17 -0
- package/build/abi/shared/json/stable/PEGGED_COIN.js +25 -0
- package/build/abi/shared/json/stable/STABLE_COIN.js +16 -0
- package/build/contracts/CallResult.d.ts +6 -2
- package/build/contracts/CallResult.js +122 -6
- package/build/contracts/CallResultSerializer.d.ts +42 -0
- package/build/contracts/CallResultSerializer.js +314 -0
- package/build/opnet.d.ts +1 -0
- package/build/opnet.js +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/build/utxos/UTXOsManager.d.ts +3 -1
- package/build/utxos/UTXOsManager.js +117 -14
- package/build/utxos/interfaces/IProviderForUTXO.d.ts +2 -1
- package/build/utxos/interfaces/IUTXOsManager.d.ts +5 -0
- package/docs/README.md +405 -0
- package/docs/abi-reference/abi-overview.md +312 -0
- package/docs/abi-reference/custom-abis.md +416 -0
- package/docs/abi-reference/data-types.md +435 -0
- package/docs/abi-reference/factory-abis.md +381 -0
- package/docs/abi-reference/motoswap-abis.md +665 -0
- package/docs/abi-reference/op20-abi.md +364 -0
- package/docs/abi-reference/op20s-abi.md +365 -0
- package/docs/abi-reference/op721-abi.md +609 -0
- package/docs/abi-reference/stablecoin-abis.md +267 -0
- package/docs/api-reference/contract-api.md +443 -0
- package/docs/api-reference/epoch-api.md +323 -0
- package/docs/api-reference/provider-api.md +518 -0
- package/docs/api-reference/types-interfaces.md +599 -0
- package/docs/api-reference/utxo-manager-api.md +276 -0
- package/docs/bitcoin/balances.md +362 -0
- package/docs/bitcoin/sending-bitcoin.md +581 -0
- package/docs/bitcoin/utxo-optimization.md +772 -0
- package/docs/bitcoin/utxos.md +419 -0
- package/docs/blocks/block-operations.md +406 -0
- package/docs/blocks/block-witnesses.md +440 -0
- package/docs/blocks/gas-parameters.md +435 -0
- package/docs/blocks/reorg-detection.md +531 -0
- package/docs/contracts/contract-code.md +266 -0
- package/docs/contracts/gas-estimation.md +231 -0
- package/docs/contracts/instantiating-contracts.md +402 -0
- package/docs/contracts/offline-signing.md +389 -0
- package/docs/contracts/overview.md +357 -0
- package/docs/contracts/sending-transactions.md +524 -0
- package/docs/contracts/simulating-calls.md +659 -0
- package/docs/contracts/transaction-configuration.md +527 -0
- package/docs/epochs/epoch-operations.md +475 -0
- package/docs/epochs/mining-template.md +574 -0
- package/docs/epochs/overview.md +253 -0
- package/docs/epochs/submitting-epochs.md +694 -0
- package/docs/examples/advanced-swaps.md +951 -0
- package/docs/examples/deployment-examples.md +670 -0
- package/docs/examples/op20-examples.md +498 -0
- package/docs/examples/op721-examples.md +926 -0
- package/docs/getting-started/installation.md +331 -0
- package/docs/getting-started/overview.md +318 -0
- package/docs/getting-started/quick-start.md +513 -0
- package/docs/providers/advanced-configuration.md +489 -0
- package/docs/providers/internal-caching.md +262 -0
- package/docs/providers/json-rpc-provider.md +482 -0
- package/docs/providers/understanding-providers.md +297 -0
- package/docs/providers/websocket-provider.md +389 -0
- package/docs/public-keys/public-key-operations.md +485 -0
- package/docs/storage/storage-operations.md +556 -0
- package/docs/transactions/broadcasting.md +505 -0
- package/docs/transactions/challenges.md +433 -0
- package/docs/transactions/fetching-transactions.md +478 -0
- package/docs/transactions/transaction-receipts.md +490 -0
- package/docs/utils/binary-serialization.md +1075 -0
- package/docs/utils/bitcoin-utils.md +297 -0
- package/docs/utils/revert-decoder.md +463 -0
- package/package.json +12 -7
- package/src/_version.ts +1 -1
- package/src/abi/shared/interfaces/motoswap/IMotoChef.ts +17 -0
- package/src/abi/shared/interfaces/motoswap/IMotoChefFactory.ts +104 -0
- package/src/abi/shared/interfaces/motoswap/IOP20Factory.ts +72 -0
- package/src/abi/shared/interfaces/motoswap/ITemplateMotoChef.ts +63 -0
- package/src/abi/shared/interfaces/motoswap/ITemplateOP20.ts +79 -0
- package/src/abi/shared/interfaces/opnet/IExtendedOP721Contract.ts +18 -10
- package/src/abi/shared/interfaces/opnet/IOP20Contract.ts +174 -51
- package/src/abi/shared/interfaces/opnet/IOP721Contract.ts +96 -69
- package/src/abi/shared/interfaces/stable/IOracleCoinExample.ts +16 -1
- package/src/abi/shared/interfaces/stable/IPeggedCoinExample.ts +21 -2
- package/src/abi/shared/interfaces/stable/IStableCoinExample.ts +26 -7
- package/src/abi/shared/json/motoswap/MOTOCHEF_ABI.ts +29 -1
- package/src/abi/shared/json/motoswap/MOTOCHEF_FACTORY_ABI.ts +191 -0
- package/src/abi/shared/json/motoswap/OP20_FACTORY_ABI.ts +138 -0
- package/src/abi/shared/json/motoswap/TEMPLATE_MOTOCHEF_ABI.ts +150 -0
- package/src/abi/shared/json/motoswap/TEMPLATE_OP20_ABI.ts +132 -0
- package/src/abi/shared/json/opnet/OP_20_ABI.ts +126 -156
- package/src/abi/shared/json/opnet/OP_721_ABI.ts +91 -104
- package/src/abi/shared/json/stable/ORACLE_COIN.ts +17 -0
- package/src/abi/shared/json/stable/PEGGED_COIN.ts +25 -0
- package/src/abi/shared/json/stable/STABLE_COIN.ts +16 -0
- package/src/contracts/CallResult.ts +204 -8
- package/src/contracts/CallResultSerializer.ts +458 -0
- package/src/opnet.ts +1 -0
- package/src/utxos/UTXOsManager.ts +192 -22
- package/src/utxos/interfaces/IProviderForUTXO.ts +2 -1
- package/src/utxos/interfaces/IUTXOsManager.ts +13 -0
- package/test/call-result-serializer.test.ts +1332 -0
- package/test/utxos-manager.test.ts +2012 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +2 -1
- package/vite.config.browser.ts +14 -4
- package/vitest.config.ts +22 -0
- package/build/tsconfig.tsbuildinfo +0 -1
- package/examples/UTXOManager.md +0 -418
package/README.md
CHANGED
|
@@ -1,126 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OPNet - Smart Contracts on Bitcoin L1
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|

|
|
7
|
-

|
|
8
|
-

|
|
9
7
|
|
|
10
8
|
[](https://github.com/prettier/prettier)
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
The official client library for building Bitcoin-based applications on OPNet. Full TypeScript support with type-safe contract interactions.
|
|
13
11
|
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
+
## Documentation
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
the `docs/` directory of the repository.
|
|
20
|
+
Check out the full documentation in [`/docs`](./docs)!
|
|
38
21
|
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
+
| Network | URL |
|
|
33
|
+
|---------|-----|
|
|
34
|
+
| Mainnet | `https://mainnet.opnet.org` |
|
|
35
|
+
| Regtest | `https://regtest.opnet.org` |
|
|
55
36
|
|
|
56
|
-
|
|
57
|
-
lines of code:
|
|
37
|
+
## Quick Start
|
|
58
38
|
|
|
59
39
|
```typescript
|
|
60
|
-
import {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
81
|
-
|
|
62
|
+
networks.regtest,
|
|
63
|
+
myAddress
|
|
82
64
|
);
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
signer: wallet.keypair,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
console.log('
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
##
|
|
112
|
+
## Contributing
|
|
117
113
|
|
|
118
|
-
Contributions
|
|
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
|
-
|
|
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)
|
package/browser/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
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 {
|
|
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
|
-
},
|
|
26
|
+
}, [
|
|
27
|
+
]>;
|
|
27
28
|
export type ReserveNFT = CallResult<{
|
|
28
29
|
readonly remainingPayment: bigint;
|
|
29
30
|
readonly reservationBlock: bigint;
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
},
|
|
43
|
-
|
|
44
|
-
export type
|
|
45
|
-
export
|
|
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;
|