@btc-vision/cli 1.0.7 → 1.0.8

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.
@@ -0,0 +1,234 @@
1
+ import { confirm } from '@inquirer/prompts';
2
+ import { BaseCommand } from './BaseCommand.js';
3
+ import { CLIWallet } from '../lib/wallet.js';
4
+ import { canSign, loadCredentials } from '../lib/credentials.js';
5
+ import { detectContenthashType, getContenthash, getContenthashTypeName, getDomain, getResolverContract, getSubdomain, isSubdomain, parseDomainName, validateCIDv0, validateCIDv1, validateIPNS, } from '../lib/resolver.js';
6
+ import { buildTransactionParams, checkBalance, DEFAULT_FEE_RATE, DEFAULT_MAX_SAT_TO_SPEND, formatSats, getWalletAddress, waitForTransactionConfirmation, } from '../lib/transaction.js';
7
+ import { CONTENTHASH_TYPE_CIDv0, CONTENTHASH_TYPE_CIDv1, CONTENTHASH_TYPE_IPNS, CONTENTHASH_TYPE_SHA256, } from '../types/BtcResolver.js';
8
+ export class WebsitePublishCommand extends BaseCommand {
9
+ constructor() {
10
+ super('website', 'Publish a website to a .btc domain');
11
+ }
12
+ configure() {
13
+ this.command
14
+ .argument('<domain>', 'Domain name (e.g., mysite or mysite.btc)')
15
+ .argument('<contenthash>', 'IPFS CID, IPNS ID, or SHA256 hash')
16
+ .option('-n, --network <network>', 'Network to use', 'mainnet')
17
+ .option('--dry-run', 'Show what would be published without publishing')
18
+ .option('-y, --yes', 'Skip confirmation prompts')
19
+ .option('-t, --type <type>', 'Contenthash type: cidv0, cidv1, ipns, sha256 (auto-detected if not specified)')
20
+ .action((domain, contenthash, options) => this.execute(domain, contenthash, options || { network: 'mainnet' }));
21
+ }
22
+ async execute(domain, contenthash, options) {
23
+ try {
24
+ const network = (options.network || 'mainnet');
25
+ const name = parseDomainName(domain.toLowerCase());
26
+ const isSubdomainName = isSubdomain(name);
27
+ const displayName = `${name}.btc`;
28
+ this.logger.info(`Publishing website to ${displayName}...`);
29
+ let hashType;
30
+ if (options.type) {
31
+ switch (options.type.toLowerCase()) {
32
+ case 'cidv0':
33
+ hashType = CONTENTHASH_TYPE_CIDv0;
34
+ break;
35
+ case 'cidv1':
36
+ hashType = CONTENTHASH_TYPE_CIDv1;
37
+ break;
38
+ case 'ipns':
39
+ hashType = CONTENTHASH_TYPE_IPNS;
40
+ break;
41
+ case 'sha256':
42
+ hashType = CONTENTHASH_TYPE_SHA256;
43
+ break;
44
+ default:
45
+ this.logger.fail(`Invalid type: ${options.type}`);
46
+ this.logger.info('Valid types: cidv0, cidv1, ipns, sha256');
47
+ process.exit(1);
48
+ }
49
+ }
50
+ else {
51
+ const detected = detectContenthashType(contenthash);
52
+ if (detected === null) {
53
+ this.logger.fail('Could not detect contenthash type');
54
+ this.logger.info('Specify the type with --type option');
55
+ this.logger.info('Valid types: cidv0, cidv1, ipns, sha256');
56
+ process.exit(1);
57
+ }
58
+ hashType = detected;
59
+ }
60
+ let validationError = null;
61
+ switch (hashType) {
62
+ case CONTENTHASH_TYPE_CIDv0:
63
+ validationError = validateCIDv0(contenthash);
64
+ break;
65
+ case CONTENTHASH_TYPE_CIDv1:
66
+ validationError = validateCIDv1(contenthash);
67
+ break;
68
+ case CONTENTHASH_TYPE_IPNS:
69
+ validationError = validateIPNS(contenthash);
70
+ break;
71
+ case CONTENTHASH_TYPE_SHA256:
72
+ if (!/^[0-9a-fA-F]{64}$/.test(contenthash)) {
73
+ validationError = 'SHA256 hash must be 64 hex characters';
74
+ }
75
+ break;
76
+ }
77
+ if (validationError) {
78
+ this.logger.fail(`Invalid contenthash: ${validationError}`);
79
+ process.exit(1);
80
+ }
81
+ this.logger.success(`Contenthash type: ${getContenthashTypeName(hashType)}`);
82
+ this.logger.info('Loading wallet...');
83
+ const credentials = loadCredentials();
84
+ if (!credentials || !canSign(credentials)) {
85
+ this.logger.fail('No credentials configured');
86
+ this.logger.warn('Run `opnet login` to configure your wallet.');
87
+ process.exit(1);
88
+ }
89
+ const wallet = CLIWallet.fromCredentials(credentials);
90
+ this.logger.success('Wallet loaded');
91
+ this.logger.info('Checking domain ownership...');
92
+ let ownerAddress;
93
+ if (isSubdomainName) {
94
+ const subdomainInfo = await getSubdomain(name, network);
95
+ if (!subdomainInfo) {
96
+ this.logger.fail(`Subdomain ${displayName} does not exist`);
97
+ process.exit(1);
98
+ }
99
+ ownerAddress = subdomainInfo.owner.toHex();
100
+ }
101
+ else {
102
+ const domainInfo = await getDomain(name, network);
103
+ if (!domainInfo) {
104
+ this.logger.fail(`Domain ${displayName} does not exist`);
105
+ this.logger.info('Register the domain first');
106
+ process.exit(1);
107
+ }
108
+ ownerAddress = domainInfo.owner.toHex();
109
+ }
110
+ if (wallet.address.toHex() !== ownerAddress) {
111
+ this.logger.fail('You are not the owner of this domain');
112
+ this.logger.log(`Domain owner: ${ownerAddress}`);
113
+ this.logger.log(`Your address: ${wallet.p2trAddress}`);
114
+ this.logger.log(`MLDSA Public Key Hash: ${wallet.address.toHex()}`);
115
+ process.exit(1);
116
+ }
117
+ this.logger.success('Ownership verified');
118
+ const currentContenthash = await getContenthash(name, network);
119
+ if (currentContenthash.hashType !== 0) {
120
+ this.logger.warn(`Current contenthash: ${currentContenthash.hashString || 'SHA256 hash'} (${getContenthashTypeName(currentContenthash.hashType)})`);
121
+ }
122
+ this.logger.info('Checking wallet balance...');
123
+ const { sufficient, balance } = await checkBalance(wallet, network);
124
+ if (!sufficient) {
125
+ this.logger.fail('Insufficient balance');
126
+ this.logger.error(`Wallet balance: ${formatSats(balance)}`);
127
+ this.logger.error('Please fund your wallet to pay for gas fees.');
128
+ process.exit(1);
129
+ }
130
+ this.logger.success(`Wallet balance: ${formatSats(balance)}`);
131
+ this.logger.log('');
132
+ this.logger.info('Publishing Summary');
133
+ this.logger.log('-'.repeat(50));
134
+ this.logger.log(`Domain: ${displayName}`);
135
+ this.logger.log(`Type: ${getContenthashTypeName(hashType)}`);
136
+ this.logger.log(`Contenthash: ${contenthash}`);
137
+ this.logger.log(`Network: ${network}`);
138
+ if (hashType === CONTENTHASH_TYPE_CIDv0 || hashType === CONTENTHASH_TYPE_CIDv1) {
139
+ this.logger.log(`Gateway URL: https://ipfs.opnet.org/ipfs/${contenthash}`);
140
+ }
141
+ else if (hashType === CONTENTHASH_TYPE_IPNS) {
142
+ this.logger.log(`Gateway URL: https://ipfs.opnet.org/ipns/${contenthash}`);
143
+ }
144
+ this.logger.log('');
145
+ if (options.dryRun) {
146
+ this.logger.warn('Dry run - no changes made.');
147
+ return;
148
+ }
149
+ if (!options.yes) {
150
+ const confirmed = await confirm({
151
+ message: 'Publish website to this domain?',
152
+ default: true,
153
+ });
154
+ if (!confirmed) {
155
+ this.logger.warn('Publishing cancelled.');
156
+ return;
157
+ }
158
+ }
159
+ this.logger.info('Setting contenthash...');
160
+ const sender = getWalletAddress(wallet);
161
+ const contract = getResolverContract(network, sender);
162
+ const txParams = buildTransactionParams(wallet, network, DEFAULT_MAX_SAT_TO_SPEND, DEFAULT_FEE_RATE);
163
+ let result;
164
+ if (hashType === CONTENTHASH_TYPE_CIDv0) {
165
+ result = await contract.setContenthashCIDv0(name, contenthash);
166
+ }
167
+ else if (hashType === CONTENTHASH_TYPE_CIDv1) {
168
+ result = await contract.setContenthashCIDv1(name, contenthash);
169
+ }
170
+ else if (hashType === CONTENTHASH_TYPE_IPNS) {
171
+ result = await contract.setContenthashIPNS(name, contenthash);
172
+ }
173
+ else if (hashType === CONTENTHASH_TYPE_SHA256) {
174
+ const hexMatches = contenthash.match(/.{1,2}/g);
175
+ if (!hexMatches) {
176
+ this.logger.fail('Invalid SHA256 hash format');
177
+ process.exit(1);
178
+ }
179
+ const hashBytes = new Uint8Array(hexMatches.map((byte) => parseInt(byte, 16)));
180
+ result = await contract.setContenthashSHA256(name, hashBytes);
181
+ }
182
+ else {
183
+ this.logger.fail('Unknown contenthash type');
184
+ process.exit(1);
185
+ }
186
+ if (result.revert) {
187
+ this.logger.fail('Transaction would fail');
188
+ this.logger.error(`Reason: ${result.revert}`);
189
+ process.exit(1);
190
+ }
191
+ if (result.estimatedGas) {
192
+ this.logger.info(`Estimated gas: ${result.estimatedGas} sats`);
193
+ }
194
+ const receipt = await result.sendTransaction(txParams);
195
+ this.logger.log('');
196
+ this.logger.success('Website published successfully!');
197
+ this.logger.log('');
198
+ this.logger.log(`Domain: ${displayName}`);
199
+ this.logger.log(`Contenthash: ${contenthash}`);
200
+ this.logger.log(`Type: ${getContenthashTypeName(hashType)}`);
201
+ this.logger.log(`Transaction ID: ${receipt.transactionId}`);
202
+ this.logger.log(`Fees paid: ${formatSats(receipt.estimatedFees)}`);
203
+ if (hashType === CONTENTHASH_TYPE_CIDv0 || hashType === CONTENTHASH_TYPE_CIDv1) {
204
+ this.logger.log(`Gateway URL: https://ipfs.opnet.org/ipfs/${contenthash}`);
205
+ }
206
+ else if (hashType === CONTENTHASH_TYPE_IPNS) {
207
+ this.logger.log(`Gateway URL: https://ipfs.opnet.org/ipns/${contenthash}`);
208
+ }
209
+ this.logger.log('');
210
+ const confirmationResult = await waitForTransactionConfirmation(receipt.transactionId, network, {
211
+ message: 'Waiting for transaction confirmation',
212
+ });
213
+ if (!confirmationResult.confirmed) {
214
+ if (confirmationResult.revert) {
215
+ this.logger.fail('Transaction failed');
216
+ this.logger.error(`Reason: ${confirmationResult.revert}`);
217
+ }
218
+ else if (confirmationResult.error) {
219
+ this.logger.warn('Transaction not yet confirmed');
220
+ this.logger.warn(confirmationResult.error);
221
+ }
222
+ }
223
+ }
224
+ catch (error) {
225
+ this.logger.fail('Website publishing failed');
226
+ if (this.isUserCancelled(error)) {
227
+ this.logger.warn('Publishing cancelled.');
228
+ process.exit(0);
229
+ }
230
+ this.exitWithError(this.formatError(error));
231
+ }
232
+ }
233
+ }
234
+ export const websitePublishCommand = new WebsitePublishCommand().getCommand();
package/build/index.js CHANGED
@@ -21,6 +21,9 @@ import { installCommand } from './commands/InstallCommand.js';
21
21
  import { updateCommand } from './commands/UpdateCommand.js';
22
22
  import { listCommand } from './commands/ListCommand.js';
23
23
  import { searchCommand } from './commands/SearchCommand.js';
24
+ import { websitePublishCommand } from './commands/WebsitePublishCommand.js';
25
+ import { domainCommand } from './commands/DomainCommand.js';
26
+ import { websiteDeployCommand } from './commands/WebsiteDeployCommand.js';
24
27
  const logger = new Logger();
25
28
  const program = new Command();
26
29
  program
@@ -47,6 +50,9 @@ program.addCommand(installCommand);
47
50
  program.addCommand(updateCommand);
48
51
  program.addCommand(listCommand);
49
52
  program.addCommand(searchCommand);
53
+ program.addCommand(domainCommand);
54
+ program.addCommand(websitePublishCommand);
55
+ program.addCommand(websiteDeployCommand);
50
56
  program.showHelpAfterError();
51
57
  program.showSuggestionAfterError();
52
58
  program.exitOverride((err) => {
@@ -0,0 +1,2 @@
1
+ import { BitcoinInterfaceAbi } from 'opnet';
2
+ export declare const BTC_RESOLVER_ABI: BitcoinInterfaceAbi;
@@ -0,0 +1,280 @@
1
+ import { BitcoinAbiTypes } from 'opnet';
2
+ import { ABIDataTypes } from '@btc-vision/transaction';
3
+ export const BTC_RESOLVER_ABI = [
4
+ {
5
+ name: 'setTreasuryAddress',
6
+ type: BitcoinAbiTypes.Function,
7
+ inputs: [{ name: 'treasuryAddress', type: ABIDataTypes.STRING }],
8
+ outputs: [],
9
+ },
10
+ {
11
+ name: 'setDomainPrice',
12
+ type: BitcoinAbiTypes.Function,
13
+ inputs: [{ name: 'priceSats', type: ABIDataTypes.UINT64 }],
14
+ outputs: [],
15
+ },
16
+ {
17
+ name: 'registerDomain',
18
+ type: BitcoinAbiTypes.Function,
19
+ inputs: [{ name: 'domainName', type: ABIDataTypes.STRING }],
20
+ outputs: [],
21
+ },
22
+ {
23
+ name: 'initiateTransfer',
24
+ type: BitcoinAbiTypes.Function,
25
+ inputs: [
26
+ { name: 'domainName', type: ABIDataTypes.STRING },
27
+ { name: 'newOwner', type: ABIDataTypes.ADDRESS },
28
+ ],
29
+ outputs: [],
30
+ },
31
+ {
32
+ name: 'acceptTransfer',
33
+ type: BitcoinAbiTypes.Function,
34
+ inputs: [{ name: 'domainName', type: ABIDataTypes.STRING }],
35
+ outputs: [],
36
+ },
37
+ {
38
+ name: 'cancelTransfer',
39
+ type: BitcoinAbiTypes.Function,
40
+ inputs: [{ name: 'domainName', type: ABIDataTypes.STRING }],
41
+ outputs: [],
42
+ },
43
+ {
44
+ name: 'createSubdomain',
45
+ type: BitcoinAbiTypes.Function,
46
+ inputs: [
47
+ { name: 'parentDomain', type: ABIDataTypes.STRING },
48
+ { name: 'subdomainLabel', type: ABIDataTypes.STRING },
49
+ { name: 'subdomainOwner', type: ABIDataTypes.ADDRESS },
50
+ ],
51
+ outputs: [],
52
+ },
53
+ {
54
+ name: 'deleteSubdomain',
55
+ type: BitcoinAbiTypes.Function,
56
+ inputs: [
57
+ { name: 'parentDomain', type: ABIDataTypes.STRING },
58
+ { name: 'subdomainLabel', type: ABIDataTypes.STRING },
59
+ ],
60
+ outputs: [],
61
+ },
62
+ {
63
+ name: 'setContenthashCIDv0',
64
+ type: BitcoinAbiTypes.Function,
65
+ inputs: [
66
+ { name: 'name', type: ABIDataTypes.STRING },
67
+ { name: 'cid', type: ABIDataTypes.STRING },
68
+ ],
69
+ outputs: [],
70
+ },
71
+ {
72
+ name: 'setContenthashCIDv1',
73
+ type: BitcoinAbiTypes.Function,
74
+ inputs: [
75
+ { name: 'name', type: ABIDataTypes.STRING },
76
+ { name: 'cid', type: ABIDataTypes.STRING },
77
+ ],
78
+ outputs: [],
79
+ },
80
+ {
81
+ name: 'setContenthashIPNS',
82
+ type: BitcoinAbiTypes.Function,
83
+ inputs: [
84
+ { name: 'name', type: ABIDataTypes.STRING },
85
+ { name: 'ipnsId', type: ABIDataTypes.STRING },
86
+ ],
87
+ outputs: [],
88
+ },
89
+ {
90
+ name: 'setContenthashSHA256',
91
+ type: BitcoinAbiTypes.Function,
92
+ inputs: [
93
+ { name: 'name', type: ABIDataTypes.STRING },
94
+ { name: 'hash', type: ABIDataTypes.BYTES32 },
95
+ ],
96
+ outputs: [],
97
+ },
98
+ {
99
+ name: 'clearContenthash',
100
+ type: BitcoinAbiTypes.Function,
101
+ inputs: [{ name: 'name', type: ABIDataTypes.STRING }],
102
+ outputs: [],
103
+ },
104
+ {
105
+ name: 'setTTL',
106
+ type: BitcoinAbiTypes.Function,
107
+ inputs: [
108
+ { name: 'name', type: ABIDataTypes.STRING },
109
+ { name: 'ttl', type: ABIDataTypes.UINT64 },
110
+ ],
111
+ outputs: [],
112
+ },
113
+ {
114
+ name: 'getDomain',
115
+ type: BitcoinAbiTypes.Function,
116
+ inputs: [{ name: 'domainName', type: ABIDataTypes.STRING }],
117
+ outputs: [
118
+ { name: 'exists', type: ABIDataTypes.BOOL },
119
+ { name: 'owner', type: ABIDataTypes.ADDRESS },
120
+ { name: 'createdAt', type: ABIDataTypes.UINT64 },
121
+ { name: 'ttl', type: ABIDataTypes.UINT64 },
122
+ ],
123
+ },
124
+ {
125
+ name: 'getSubdomain',
126
+ type: BitcoinAbiTypes.Function,
127
+ inputs: [{ name: 'fullName', type: ABIDataTypes.STRING }],
128
+ outputs: [
129
+ { name: 'exists', type: ABIDataTypes.BOOL },
130
+ { name: 'owner', type: ABIDataTypes.ADDRESS },
131
+ { name: 'parentHash', type: ABIDataTypes.BYTES32 },
132
+ { name: 'ttl', type: ABIDataTypes.UINT64 },
133
+ ],
134
+ },
135
+ {
136
+ name: 'getContenthash',
137
+ type: BitcoinAbiTypes.Function,
138
+ inputs: [{ name: 'name', type: ABIDataTypes.STRING }],
139
+ outputs: [
140
+ { name: 'hashType', type: ABIDataTypes.UINT8 },
141
+ { name: 'hashData', type: ABIDataTypes.BYTES32 },
142
+ { name: 'hashString', type: ABIDataTypes.STRING },
143
+ ],
144
+ },
145
+ {
146
+ name: 'resolve',
147
+ type: BitcoinAbiTypes.Function,
148
+ inputs: [{ name: 'name', type: ABIDataTypes.STRING }],
149
+ outputs: [{ name: 'owner', type: ABIDataTypes.ADDRESS }],
150
+ },
151
+ {
152
+ name: 'getPendingTransfer',
153
+ type: BitcoinAbiTypes.Function,
154
+ inputs: [{ name: 'domainName', type: ABIDataTypes.STRING }],
155
+ outputs: [
156
+ { name: 'pendingOwner', type: ABIDataTypes.ADDRESS },
157
+ { name: 'initiatedAt', type: ABIDataTypes.UINT64 },
158
+ ],
159
+ },
160
+ {
161
+ name: 'getTreasuryAddress',
162
+ type: BitcoinAbiTypes.Function,
163
+ inputs: [],
164
+ outputs: [{ name: 'treasuryAddress', type: ABIDataTypes.STRING }],
165
+ },
166
+ {
167
+ name: 'getDomainPrice',
168
+ type: BitcoinAbiTypes.Function,
169
+ inputs: [{ name: 'domainName', type: ABIDataTypes.STRING }],
170
+ outputs: [{ name: 'priceSats', type: ABIDataTypes.UINT64 }],
171
+ },
172
+ {
173
+ name: 'getBaseDomainPrice',
174
+ type: BitcoinAbiTypes.Function,
175
+ inputs: [],
176
+ outputs: [{ name: 'priceSats', type: ABIDataTypes.UINT64 }],
177
+ },
178
+ {
179
+ name: 'DomainRegistered',
180
+ type: BitcoinAbiTypes.Event,
181
+ values: [
182
+ { name: 'domainHash', type: ABIDataTypes.UINT256 },
183
+ { name: 'owner', type: ABIDataTypes.ADDRESS },
184
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
185
+ ],
186
+ },
187
+ {
188
+ name: 'DomainTransferInitiated',
189
+ type: BitcoinAbiTypes.Event,
190
+ values: [
191
+ { name: 'domainHash', type: ABIDataTypes.UINT256 },
192
+ { name: 'currentOwner', type: ABIDataTypes.ADDRESS },
193
+ { name: 'newOwner', type: ABIDataTypes.ADDRESS },
194
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
195
+ ],
196
+ },
197
+ {
198
+ name: 'DomainTransferCompleted',
199
+ type: BitcoinAbiTypes.Event,
200
+ values: [
201
+ { name: 'domainHash', type: ABIDataTypes.UINT256 },
202
+ { name: 'previousOwner', type: ABIDataTypes.ADDRESS },
203
+ { name: 'newOwner', type: ABIDataTypes.ADDRESS },
204
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
205
+ ],
206
+ },
207
+ {
208
+ name: 'DomainTransferCancelled',
209
+ type: BitcoinAbiTypes.Event,
210
+ values: [
211
+ { name: 'domainHash', type: ABIDataTypes.UINT256 },
212
+ { name: 'owner', type: ABIDataTypes.ADDRESS },
213
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
214
+ ],
215
+ },
216
+ {
217
+ name: 'SubdomainCreated',
218
+ type: BitcoinAbiTypes.Event,
219
+ values: [
220
+ { name: 'parentDomainHash', type: ABIDataTypes.UINT256 },
221
+ { name: 'subdomainHash', type: ABIDataTypes.UINT256 },
222
+ { name: 'owner', type: ABIDataTypes.ADDRESS },
223
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
224
+ ],
225
+ },
226
+ {
227
+ name: 'SubdomainDeleted',
228
+ type: BitcoinAbiTypes.Event,
229
+ values: [
230
+ { name: 'parentDomainHash', type: ABIDataTypes.UINT256 },
231
+ { name: 'subdomainHash', type: ABIDataTypes.UINT256 },
232
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
233
+ ],
234
+ },
235
+ {
236
+ name: 'ContenthashChanged',
237
+ type: BitcoinAbiTypes.Event,
238
+ values: [
239
+ { name: 'nameHash', type: ABIDataTypes.UINT256 },
240
+ { name: 'contenthashType', type: ABIDataTypes.UINT8 },
241
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
242
+ ],
243
+ },
244
+ {
245
+ name: 'ContenthashCleared',
246
+ type: BitcoinAbiTypes.Event,
247
+ values: [
248
+ { name: 'nameHash', type: ABIDataTypes.UINT256 },
249
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
250
+ ],
251
+ },
252
+ {
253
+ name: 'TTLChanged',
254
+ type: BitcoinAbiTypes.Event,
255
+ values: [
256
+ { name: 'nameHash', type: ABIDataTypes.UINT256 },
257
+ { name: 'oldTTL', type: ABIDataTypes.UINT64 },
258
+ { name: 'newTTL', type: ABIDataTypes.UINT64 },
259
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
260
+ ],
261
+ },
262
+ {
263
+ name: 'DomainPriceChanged',
264
+ type: BitcoinAbiTypes.Event,
265
+ values: [
266
+ { name: 'oldPrice', type: ABIDataTypes.UINT64 },
267
+ { name: 'newPrice', type: ABIDataTypes.UINT64 },
268
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
269
+ ],
270
+ },
271
+ {
272
+ name: 'TreasuryChanged',
273
+ type: BitcoinAbiTypes.Event,
274
+ values: [
275
+ { name: 'previousAddressHash', type: ABIDataTypes.UINT256 },
276
+ { name: 'newAddressHash', type: ABIDataTypes.UINT256 },
277
+ { name: 'timestamp', type: ABIDataTypes.UINT64 },
278
+ ],
279
+ },
280
+ ];
@@ -21,6 +21,11 @@ export const DEFAULT_CONFIG = {
21
21
  testnet: '',
22
22
  regtest: '0x0737d17d0eff9915208f3c20ed7659587889bc94d25972672b3a6c03ff4ddbcc',
23
23
  },
24
+ resolverAddresses: {
25
+ mainnet: '',
26
+ testnet: '',
27
+ regtest: '0x336dcb0b117e29a61aef4856dc438f9951de39edcc4745a255713da8f807779c',
28
+ },
24
29
  defaultMldsaLevel: 44,
25
30
  indexerUrl: 'https://indexer.opnet.org',
26
31
  };
@@ -92,6 +97,12 @@ export function loadConfig() {
92
97
  ...fileConfig.registryAddresses,
93
98
  ...envOverrides.registryAddresses,
94
99
  },
100
+ resolverAddresses: fileConfig.resolverAddresses
101
+ ? {
102
+ ...DEFAULT_CONFIG.resolverAddresses,
103
+ ...fileConfig.resolverAddresses,
104
+ }
105
+ : DEFAULT_CONFIG.resolverAddresses,
95
106
  };
96
107
  }
97
108
  export function saveConfig(config) {
@@ -12,3 +12,10 @@ export declare function buildGatewayUrl(gateway: string, cid: string): string;
12
12
  export declare function isValidCid(cid: string): boolean;
13
13
  export declare function downloadPlugin(cid: string, outputPath: string): Promise<number>;
14
14
  export declare function uploadPlugin(filePath: string): Promise<PinResult>;
15
+ export interface DirectoryPinResult {
16
+ cid: string;
17
+ files: number;
18
+ totalSize: number;
19
+ }
20
+ export declare function uploadDirectory(dirPath: string, wrapWithDirectory?: boolean): Promise<DirectoryPinResult>;
21
+ export declare function uploadFile(filePath: string): Promise<PinResult>;