@btc-vision/cli 1.0.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 (110) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/dependabot.yml +9 -0
  3. package/.github/workflows/ci.yml +48 -0
  4. package/.prettierrc.json +12 -0
  5. package/CONTRIBUTING.md +56 -0
  6. package/LICENSE +190 -0
  7. package/NOTICE +17 -0
  8. package/README.md +509 -0
  9. package/SECURITY.md +35 -0
  10. package/build/commands/AcceptCommand.d.ts +7 -0
  11. package/build/commands/AcceptCommand.js +110 -0
  12. package/build/commands/BaseCommand.d.ts +12 -0
  13. package/build/commands/BaseCommand.js +27 -0
  14. package/build/commands/CompileCommand.d.ts +7 -0
  15. package/build/commands/CompileCommand.js +138 -0
  16. package/build/commands/ConfigCommand.d.ts +17 -0
  17. package/build/commands/ConfigCommand.js +124 -0
  18. package/build/commands/DeprecateCommand.d.ts +7 -0
  19. package/build/commands/DeprecateCommand.js +112 -0
  20. package/build/commands/InfoCommand.d.ts +10 -0
  21. package/build/commands/InfoCommand.js +223 -0
  22. package/build/commands/InitCommand.d.ts +16 -0
  23. package/build/commands/InitCommand.js +336 -0
  24. package/build/commands/InstallCommand.d.ts +7 -0
  25. package/build/commands/InstallCommand.js +130 -0
  26. package/build/commands/KeygenCommand.d.ts +13 -0
  27. package/build/commands/KeygenCommand.js +133 -0
  28. package/build/commands/ListCommand.d.ts +7 -0
  29. package/build/commands/ListCommand.js +117 -0
  30. package/build/commands/LoginCommand.d.ts +9 -0
  31. package/build/commands/LoginCommand.js +139 -0
  32. package/build/commands/LogoutCommand.d.ts +7 -0
  33. package/build/commands/LogoutCommand.js +57 -0
  34. package/build/commands/PublishCommand.d.ts +7 -0
  35. package/build/commands/PublishCommand.js +163 -0
  36. package/build/commands/SearchCommand.d.ts +7 -0
  37. package/build/commands/SearchCommand.js +97 -0
  38. package/build/commands/SignCommand.d.ts +7 -0
  39. package/build/commands/SignCommand.js +80 -0
  40. package/build/commands/TransferCommand.d.ts +8 -0
  41. package/build/commands/TransferCommand.js +179 -0
  42. package/build/commands/UndeprecateCommand.d.ts +7 -0
  43. package/build/commands/UndeprecateCommand.js +95 -0
  44. package/build/commands/UpdateCommand.d.ts +7 -0
  45. package/build/commands/UpdateCommand.js +130 -0
  46. package/build/commands/VerifyCommand.d.ts +7 -0
  47. package/build/commands/VerifyCommand.js +167 -0
  48. package/build/commands/WhoamiCommand.d.ts +7 -0
  49. package/build/commands/WhoamiCommand.js +84 -0
  50. package/build/index.d.ts +2 -0
  51. package/build/index.js +64 -0
  52. package/build/lib/PackageRegistry.abi.d.ts +2 -0
  53. package/build/lib/PackageRegistry.abi.js +356 -0
  54. package/build/lib/binary.d.ts +16 -0
  55. package/build/lib/binary.js +165 -0
  56. package/build/lib/config.d.ts +11 -0
  57. package/build/lib/config.js +160 -0
  58. package/build/lib/credentials.d.ts +10 -0
  59. package/build/lib/credentials.js +89 -0
  60. package/build/lib/ipfs.d.ts +16 -0
  61. package/build/lib/ipfs.js +209 -0
  62. package/build/lib/manifest.d.ts +14 -0
  63. package/build/lib/manifest.js +88 -0
  64. package/build/lib/provider.d.ts +9 -0
  65. package/build/lib/provider.js +48 -0
  66. package/build/lib/registry.d.ts +58 -0
  67. package/build/lib/registry.js +197 -0
  68. package/build/lib/wallet.d.ts +32 -0
  69. package/build/lib/wallet.js +114 -0
  70. package/build/types/PackageRegistry.d.ts +177 -0
  71. package/build/types/PackageRegistry.js +1 -0
  72. package/build/types/index.d.ts +30 -0
  73. package/build/types/index.js +52 -0
  74. package/eslint.config.js +41 -0
  75. package/gulpfile.js +41 -0
  76. package/package.json +83 -0
  77. package/src/commands/AcceptCommand.ts +151 -0
  78. package/src/commands/BaseCommand.ts +59 -0
  79. package/src/commands/CompileCommand.ts +196 -0
  80. package/src/commands/ConfigCommand.ts +144 -0
  81. package/src/commands/DeprecateCommand.ts +156 -0
  82. package/src/commands/InfoCommand.ts +293 -0
  83. package/src/commands/InitCommand.ts +465 -0
  84. package/src/commands/InstallCommand.ts +179 -0
  85. package/src/commands/KeygenCommand.ts +157 -0
  86. package/src/commands/ListCommand.ts +169 -0
  87. package/src/commands/LoginCommand.ts +197 -0
  88. package/src/commands/LogoutCommand.ts +76 -0
  89. package/src/commands/PublishCommand.ts +230 -0
  90. package/src/commands/SearchCommand.ts +141 -0
  91. package/src/commands/SignCommand.ts +122 -0
  92. package/src/commands/TransferCommand.ts +235 -0
  93. package/src/commands/UndeprecateCommand.ts +134 -0
  94. package/src/commands/UpdateCommand.ts +200 -0
  95. package/src/commands/VerifyCommand.ts +228 -0
  96. package/src/commands/WhoamiCommand.ts +113 -0
  97. package/src/index.ts +86 -0
  98. package/src/lib/PackageRegistry.abi.json +765 -0
  99. package/src/lib/PackageRegistry.abi.ts +365 -0
  100. package/src/lib/binary.ts +336 -0
  101. package/src/lib/config.ts +265 -0
  102. package/src/lib/credentials.ts +176 -0
  103. package/src/lib/ipfs.ts +369 -0
  104. package/src/lib/manifest.ts +172 -0
  105. package/src/lib/provider.ts +121 -0
  106. package/src/lib/registry.ts +464 -0
  107. package/src/lib/wallet.ts +271 -0
  108. package/src/types/PackageRegistry.ts +344 -0
  109. package/src/types/index.ts +145 -0
  110. package/tsconfig.json +25 -0
@@ -0,0 +1,271 @@
1
+ /**
2
+ * Wallet operations for OPNet CLI
3
+ *
4
+ * Wraps @btc-vision/transaction Mnemonic and Wallet classes for CLI operations
5
+ *
6
+ * @module lib/wallet
7
+ */
8
+
9
+ import { Network, networks } from '@btc-vision/bitcoin';
10
+ import { MLDSASecurityLevel, QuantumBIP32Factory } from '@btc-vision/bip32';
11
+ import { EcKeyPair, MessageSigner, Mnemonic, Wallet } from '@btc-vision/transaction';
12
+ import * as crypto from 'crypto';
13
+ import { CLICredentials, CLIMldsaLevel, NetworkName } from '../types/index.js';
14
+ import { canSign, loadCredentials } from './credentials.js';
15
+
16
+ /**
17
+ * Convert CLI network name to bitcoin-js Network object
18
+ */
19
+ export function getNetwork(networkName: NetworkName): Network {
20
+ switch (networkName) {
21
+ case 'mainnet':
22
+ return networks.bitcoin;
23
+ case 'testnet':
24
+ return networks.testnet;
25
+ case 'regtest':
26
+ return networks.regtest;
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Convert CLI MLDSA level to SDK MLDSASecurityLevel enum
32
+ */
33
+ export function getMLDSASecurityLevel(level: CLIMldsaLevel): MLDSASecurityLevel {
34
+ switch (level) {
35
+ case 44:
36
+ return MLDSASecurityLevel.LEVEL2;
37
+ case 65:
38
+ return MLDSASecurityLevel.LEVEL3;
39
+ case 87:
40
+ return MLDSASecurityLevel.LEVEL5;
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Wallet wrapper that provides a unified interface for CLI operations
46
+ */
47
+ export class CLIWallet {
48
+ private readonly wallet: Wallet;
49
+ private readonly network: Network;
50
+ private readonly mldsaLevel: CLIMldsaLevel;
51
+
52
+ private constructor(wallet: Wallet, network: Network, mldsaLevel: CLIMldsaLevel) {
53
+ this.wallet = wallet;
54
+ this.network = network;
55
+ this.mldsaLevel = mldsaLevel;
56
+ }
57
+
58
+ /**
59
+ * Get the P2TR (taproot) address
60
+ */
61
+ get p2trAddress(): string {
62
+ return this.wallet.p2tr;
63
+ }
64
+
65
+ /**
66
+ * Get the underlying Wallet instance
67
+ */
68
+ get underlyingWallet(): Wallet {
69
+ return this.wallet;
70
+ }
71
+
72
+ /**
73
+ * Get the Bitcoin keypair for classical signing
74
+ */
75
+ get keypair(): EcKeyPair {
76
+ return this.wallet.keypair;
77
+ }
78
+
79
+ /**
80
+ * Get the MLDSA keypair for quantum-resistant signing
81
+ */
82
+ get mldsaKeypair(): EcKeyPair {
83
+ return this.wallet.mldsaKeypair;
84
+ }
85
+
86
+ /**
87
+ * Get the MLDSA public key
88
+ */
89
+ get mldsaPublicKey(): Buffer {
90
+ return Buffer.from(this.wallet.mldsaKeypair.publicKey);
91
+ }
92
+
93
+ /**
94
+ * Get the MLDSA public key hash (SHA-256)
95
+ */
96
+ get mldsaPublicKeyHash(): string {
97
+ const hash = crypto.createHash('sha256').update(this.mldsaPublicKey).digest();
98
+ return hash.toString('hex');
99
+ }
100
+
101
+ /**
102
+ * Get the current MLDSA security level
103
+ */
104
+ get securityLevel(): CLIMldsaLevel {
105
+ return this.mldsaLevel;
106
+ }
107
+
108
+ /**
109
+ * Get the network this wallet is configured for
110
+ */
111
+ get walletNetwork(): Network {
112
+ return this.network;
113
+ }
114
+
115
+ /**
116
+ * Create a wallet from credentials
117
+ *
118
+ * @param credentials - The credentials to use
119
+ * @returns A CLIWallet instance
120
+ */
121
+ static fromCredentials(credentials: CLICredentials): CLIWallet {
122
+ const network = getNetwork(credentials.network);
123
+ const securityLevel = getMLDSASecurityLevel(credentials.mldsaLevel);
124
+
125
+ if (credentials.mnemonic) {
126
+ // Primary method: derive from mnemonic using UniSat derivation
127
+ const mnemonic = new Mnemonic(
128
+ credentials.mnemonic,
129
+ '', // passphrase
130
+ network,
131
+ securityLevel,
132
+ );
133
+ // Use UniSat-compatible derivation with P2TR (Taproot) address type
134
+ const wallet = mnemonic.deriveUnisat();
135
+ return new CLIWallet(wallet, network, credentials.mldsaLevel);
136
+ }
137
+
138
+ if (credentials.wif && credentials.mldsaPrivateKey) {
139
+ // Advanced method: use WIF + standalone MLDSA key
140
+ const wallet = Wallet.fromWif(
141
+ credentials.wif,
142
+ credentials.mldsaPrivateKey,
143
+ network,
144
+ securityLevel,
145
+ );
146
+ return new CLIWallet(wallet, network, credentials.mldsaLevel);
147
+ }
148
+
149
+ throw new Error('Invalid credentials: requires either mnemonic or both WIF and MLDSA key');
150
+ }
151
+
152
+ /**
153
+ * Load wallet from stored credentials
154
+ *
155
+ * @returns CLIWallet instance or throws if no valid credentials
156
+ */
157
+ static load(): CLIWallet {
158
+ const credentials = loadCredentials();
159
+
160
+ if (!credentials) {
161
+ throw new Error('No credentials found. Run `opnet login` to configure your wallet.');
162
+ }
163
+
164
+ if (!canSign(credentials)) {
165
+ throw new Error(
166
+ 'Credentials incomplete for signing. Run `opnet login` to reconfigure.',
167
+ );
168
+ }
169
+
170
+ return CLIWallet.fromCredentials(credentials);
171
+ }
172
+
173
+ /**
174
+ * Verify an MLDSA signature using a public key buffer
175
+ *
176
+ * @param data - The original data that was signed
177
+ * @param signature - The signature to verify
178
+ * @param publicKey - The MLDSA public key buffer
179
+ * @param level - The MLDSA security level
180
+ * @returns True if the signature is valid
181
+ */
182
+ static verifyMLDSA(
183
+ data: Buffer,
184
+ signature: Buffer,
185
+ publicKey: Buffer,
186
+ level: CLIMldsaLevel,
187
+ ): boolean {
188
+ const securityLevel = getMLDSASecurityLevel(level);
189
+ // Create a dummy chain code (not needed for verification)
190
+ const dummyChainCode = new Uint8Array(32);
191
+ // Create a public-key-only keypair for verification
192
+ const keypair = QuantumBIP32Factory.fromPublicKey(
193
+ publicKey,
194
+ dummyChainCode,
195
+ networks.bitcoin, // Network doesn't matter for signature verification
196
+ securityLevel,
197
+ );
198
+ // Verify signature directly using the keypair
199
+ return keypair.verify(data, signature);
200
+ }
201
+
202
+ /**
203
+ * Sign data using MLDSA
204
+ *
205
+ * @param data - The data to sign (typically a SHA-256 hash)
206
+ * @returns The MLDSA signature
207
+ */
208
+ signMLDSA(data: Buffer): Buffer {
209
+ const result = MessageSigner.signMLDSAMessage(this.wallet.mldsaKeypair, data);
210
+ return Buffer.from(result.signature);
211
+ }
212
+
213
+ /**
214
+ * Verify an MLDSA signature using this wallet's keypair
215
+ *
216
+ * @param data - The original data that was signed
217
+ * @param signature - The signature to verify
218
+ * @returns True if the signature is valid
219
+ */
220
+ verifyMLDSA(data: Buffer, signature: Buffer): boolean {
221
+ return MessageSigner.verifyMLDSASignature(this.wallet.mldsaKeypair, data, signature);
222
+ }
223
+ }
224
+
225
+ /**
226
+ * Generate a standalone MLDSA keypair
227
+ *
228
+ * @param level - The MLDSA security level
229
+ * @returns Object containing privateKey and publicKey buffers
230
+ */
231
+ export function generateMLDSAKeypair(level: CLIMldsaLevel): {
232
+ privateKey: Buffer;
233
+ publicKey: Buffer;
234
+ } {
235
+ const securityLevel = getMLDSASecurityLevel(level);
236
+ const keypair = EcKeyPair.generateQuantumKeyPair(securityLevel);
237
+
238
+ return {
239
+ privateKey: Buffer.from(keypair.privateKey),
240
+ publicKey: Buffer.from(keypair.publicKey),
241
+ };
242
+ }
243
+
244
+ /**
245
+ * Compute SHA-256 hash of a public key
246
+ *
247
+ * @param publicKey - The public key buffer
248
+ * @returns Hex-encoded SHA-256 hash
249
+ */
250
+ export function computePublicKeyHash(publicKey: Buffer): string {
251
+ return crypto.createHash('sha256').update(publicKey).digest('hex');
252
+ }
253
+
254
+ /**
255
+ * Validate a BIP-39 mnemonic phrase
256
+ *
257
+ * @param phrase - The mnemonic phrase to validate
258
+ * @returns True if the phrase is valid
259
+ */
260
+ export function validateMnemonic(phrase: string): boolean {
261
+ return Mnemonic.validate(phrase);
262
+ }
263
+
264
+ /**
265
+ * Generate a new BIP-39 mnemonic phrase
266
+ *
267
+ * @returns A new 24-word mnemonic phrase
268
+ */
269
+ export function generateMnemonic(): string {
270
+ return Mnemonic.generatePhrase();
271
+ }
@@ -0,0 +1,344 @@
1
+ import { Address } from '@btc-vision/transaction';
2
+ import { CallResult, IOP_NETContract, OPNetEvent } from 'opnet';
3
+
4
+ // ------------------------------------------------------------------
5
+ // Event Definitions
6
+ // ------------------------------------------------------------------
7
+ export type TreasuryAddressChangedEvent = {
8
+ readonly previousAddressHash: bigint;
9
+ readonly newAddressHash: bigint;
10
+ readonly timestamp: bigint;
11
+ };
12
+ export type ScopePriceChangedEvent = {
13
+ readonly oldPrice: bigint;
14
+ readonly newPrice: bigint;
15
+ readonly timestamp: bigint;
16
+ };
17
+ export type PackagePriceChangedEvent = {
18
+ readonly oldPrice: bigint;
19
+ readonly newPrice: bigint;
20
+ readonly timestamp: bigint;
21
+ };
22
+ export type ScopeRegisteredEvent = {
23
+ readonly scopeHash: bigint;
24
+ readonly owner: Address;
25
+ readonly timestamp: bigint;
26
+ };
27
+ export type ScopeTransferInitiatedEvent = {
28
+ readonly scopeHash: bigint;
29
+ readonly currentOwner: Address;
30
+ readonly newOwner: Address;
31
+ readonly timestamp: bigint;
32
+ };
33
+ export type ScopeTransferCompletedEvent = {
34
+ readonly scopeHash: bigint;
35
+ readonly previousOwner: Address;
36
+ readonly newOwner: Address;
37
+ readonly timestamp: bigint;
38
+ };
39
+ export type ScopeTransferCancelledEvent = {
40
+ readonly scopeHash: bigint;
41
+ readonly owner: Address;
42
+ readonly timestamp: bigint;
43
+ };
44
+ export type PackageRegisteredEvent = {
45
+ readonly packageHash: bigint;
46
+ readonly owner: Address;
47
+ readonly timestamp: bigint;
48
+ };
49
+ export type VersionPublishedEvent = {
50
+ readonly packageHash: bigint;
51
+ readonly versionHash: bigint;
52
+ readonly publisher: Address;
53
+ readonly checksum: bigint;
54
+ readonly timestamp: bigint;
55
+ readonly mldsaLevel: number;
56
+ readonly pluginType: number;
57
+ };
58
+ export type VersionDeprecatedEvent = {
59
+ readonly packageHash: bigint;
60
+ readonly versionHash: bigint;
61
+ readonly timestamp: bigint;
62
+ };
63
+ export type VersionUndeprecatedEvent = {
64
+ readonly packageHash: bigint;
65
+ readonly versionHash: bigint;
66
+ readonly timestamp: bigint;
67
+ };
68
+ export type PackageTransferInitiatedEvent = {
69
+ readonly packageHash: bigint;
70
+ readonly currentOwner: Address;
71
+ readonly newOwner: Address;
72
+ readonly timestamp: bigint;
73
+ };
74
+ export type PackageTransferCompletedEvent = {
75
+ readonly packageHash: bigint;
76
+ readonly previousOwner: Address;
77
+ readonly newOwner: Address;
78
+ readonly timestamp: bigint;
79
+ };
80
+ export type PackageTransferCancelledEvent = {
81
+ readonly packageHash: bigint;
82
+ readonly owner: Address;
83
+ readonly timestamp: bigint;
84
+ };
85
+
86
+ // ------------------------------------------------------------------
87
+ // Call Results
88
+ // ------------------------------------------------------------------
89
+
90
+ /**
91
+ * @description Represents the result of the setTreasuryAddress function call.
92
+ */
93
+ export type SetTreasuryAddress = CallResult<{}, OPNetEvent<TreasuryAddressChangedEvent>[]>;
94
+
95
+ /**
96
+ * @description Represents the result of the setScopePrice function call.
97
+ */
98
+ export type SetScopePrice = CallResult<{}, OPNetEvent<ScopePriceChangedEvent>[]>;
99
+
100
+ /**
101
+ * @description Represents the result of the setPackagePrice function call.
102
+ */
103
+ export type SetPackagePrice = CallResult<{}, OPNetEvent<PackagePriceChangedEvent>[]>;
104
+
105
+ /**
106
+ * @description Represents the result of the registerScope function call.
107
+ */
108
+ export type RegisterScope = CallResult<{}, OPNetEvent<ScopeRegisteredEvent>[]>;
109
+
110
+ /**
111
+ * @description Represents the result of the initiateScopeTransfer function call.
112
+ */
113
+ export type InitiateScopeTransfer = CallResult<{}, OPNetEvent<ScopeTransferInitiatedEvent>[]>;
114
+
115
+ /**
116
+ * @description Represents the result of the acceptScopeTransfer function call.
117
+ */
118
+ export type AcceptScopeTransfer = CallResult<{}, OPNetEvent<ScopeTransferCompletedEvent>[]>;
119
+
120
+ /**
121
+ * @description Represents the result of the cancelScopeTransfer function call.
122
+ */
123
+ export type CancelScopeTransfer = CallResult<{}, OPNetEvent<ScopeTransferCancelledEvent>[]>;
124
+
125
+ /**
126
+ * @description Represents the result of the registerPackage function call.
127
+ */
128
+ export type RegisterPackage = CallResult<{}, OPNetEvent<PackageRegisteredEvent>[]>;
129
+
130
+ /**
131
+ * @description Represents the result of the publishVersion function call.
132
+ */
133
+ export type PublishVersion = CallResult<{}, OPNetEvent<VersionPublishedEvent>[]>;
134
+
135
+ /**
136
+ * @description Represents the result of the deprecateVersion function call.
137
+ */
138
+ export type DeprecateVersion = CallResult<{}, OPNetEvent<VersionDeprecatedEvent>[]>;
139
+
140
+ /**
141
+ * @description Represents the result of the undeprecateVersion function call.
142
+ */
143
+ export type UndeprecateVersion = CallResult<{}, OPNetEvent<VersionUndeprecatedEvent>[]>;
144
+
145
+ /**
146
+ * @description Represents the result of the initiateTransfer function call.
147
+ */
148
+ export type InitiateTransfer = CallResult<{}, OPNetEvent<PackageTransferInitiatedEvent>[]>;
149
+
150
+ /**
151
+ * @description Represents the result of the acceptTransfer function call.
152
+ */
153
+ export type AcceptTransfer = CallResult<{}, OPNetEvent<PackageTransferCompletedEvent>[]>;
154
+
155
+ /**
156
+ * @description Represents the result of the cancelTransfer function call.
157
+ */
158
+ export type CancelTransfer = CallResult<{}, OPNetEvent<PackageTransferCancelledEvent>[]>;
159
+
160
+ /**
161
+ * @description Represents the result of the getScope function call.
162
+ */
163
+ export type GetScope = CallResult<
164
+ {
165
+ exists: boolean;
166
+ owner: Address;
167
+ createdAt: bigint;
168
+ },
169
+ OPNetEvent<never>[]
170
+ >;
171
+
172
+ /**
173
+ * @description Represents the result of the getScopeOwner function call.
174
+ */
175
+ export type GetScopeOwner = CallResult<
176
+ {
177
+ owner: Address;
178
+ },
179
+ OPNetEvent<never>[]
180
+ >;
181
+
182
+ /**
183
+ * @description Represents the result of the getPackage function call.
184
+ */
185
+ export type GetPackage = CallResult<
186
+ {
187
+ exists: boolean;
188
+ owner: Address;
189
+ createdAt: bigint;
190
+ versionCount: bigint;
191
+ latestVersion: string;
192
+ },
193
+ OPNetEvent<never>[]
194
+ >;
195
+
196
+ /**
197
+ * @description Represents the result of the getOwner function call.
198
+ */
199
+ export type GetOwner = CallResult<
200
+ {
201
+ owner: Address;
202
+ },
203
+ OPNetEvent<never>[]
204
+ >;
205
+
206
+ /**
207
+ * @description Represents the result of the getVersion function call.
208
+ */
209
+ export type GetVersion = CallResult<
210
+ {
211
+ exists: boolean;
212
+ ipfsCid: string;
213
+ checksum: Uint8Array;
214
+ sigHash: Uint8Array;
215
+ mldsaLevel: number;
216
+ opnetVersionRange: string;
217
+ pluginType: number;
218
+ permissionsHash: Uint8Array;
219
+ depsHash: Uint8Array;
220
+ publisher: Address;
221
+ publishedAt: bigint;
222
+ deprecated: boolean;
223
+ },
224
+ OPNetEvent<never>[]
225
+ >;
226
+
227
+ /**
228
+ * @description Represents the result of the isDeprecated function call.
229
+ */
230
+ export type IsDeprecated = CallResult<
231
+ {
232
+ deprecated: boolean;
233
+ },
234
+ OPNetEvent<never>[]
235
+ >;
236
+
237
+ /**
238
+ * @description Represents the result of the isImmutable function call.
239
+ */
240
+ export type IsImmutable = CallResult<
241
+ {
242
+ immutable: boolean;
243
+ },
244
+ OPNetEvent<never>[]
245
+ >;
246
+
247
+ /**
248
+ * @description Represents the result of the getPendingTransfer function call.
249
+ */
250
+ export type GetPendingTransfer = CallResult<
251
+ {
252
+ pendingOwner: Address;
253
+ initiatedAt: bigint;
254
+ },
255
+ OPNetEvent<never>[]
256
+ >;
257
+
258
+ /**
259
+ * @description Represents the result of the getPendingScopeTransfer function call.
260
+ */
261
+ export type GetPendingScopeTransfer = CallResult<
262
+ {
263
+ pendingOwner: Address;
264
+ initiatedAt: bigint;
265
+ },
266
+ OPNetEvent<never>[]
267
+ >;
268
+
269
+ /**
270
+ * @description Represents the result of the getTreasuryAddress function call.
271
+ */
272
+ export type GetTreasuryAddress = CallResult<
273
+ {
274
+ treasuryAddress: string;
275
+ },
276
+ OPNetEvent<never>[]
277
+ >;
278
+
279
+ /**
280
+ * @description Represents the result of the getScopePrice function call.
281
+ */
282
+ export type GetScopePrice = CallResult<
283
+ {
284
+ priceSats: bigint;
285
+ },
286
+ OPNetEvent<never>[]
287
+ >;
288
+
289
+ /**
290
+ * @description Represents the result of the getPackagePrice function call.
291
+ */
292
+ export type GetPackagePrice = CallResult<
293
+ {
294
+ priceSats: bigint;
295
+ },
296
+ OPNetEvent<never>[]
297
+ >;
298
+
299
+ // ------------------------------------------------------------------
300
+ // IPackageRegistry
301
+ // ------------------------------------------------------------------
302
+ export interface IPackageRegistry extends IOP_NETContract {
303
+ setTreasuryAddress(treasuryAddress: string): Promise<SetTreasuryAddress>;
304
+ setScopePrice(priceSats: bigint): Promise<SetScopePrice>;
305
+ setPackagePrice(priceSats: bigint): Promise<SetPackagePrice>;
306
+ registerScope(scopeName: string): Promise<RegisterScope>;
307
+ initiateScopeTransfer(scopeName: string, newOwner: Address): Promise<InitiateScopeTransfer>;
308
+ acceptScopeTransfer(scopeName: string): Promise<AcceptScopeTransfer>;
309
+ cancelScopeTransfer(scopeName: string): Promise<CancelScopeTransfer>;
310
+ registerPackage(packageName: string): Promise<RegisterPackage>;
311
+ publishVersion(
312
+ packageName: string,
313
+ version: string,
314
+ ipfsCid: string,
315
+ checksum: Uint8Array,
316
+ signature: Uint8Array,
317
+ mldsaLevel: number,
318
+ opnetVersionRange: string,
319
+ pluginType: number,
320
+ permissionsHash: Uint8Array,
321
+ dependencies: Uint8Array,
322
+ ): Promise<PublishVersion>;
323
+ deprecateVersion(
324
+ packageName: string,
325
+ version: string,
326
+ reason: string,
327
+ ): Promise<DeprecateVersion>;
328
+ undeprecateVersion(packageName: string, version: string): Promise<UndeprecateVersion>;
329
+ initiateTransfer(packageName: string, newOwner: Address): Promise<InitiateTransfer>;
330
+ acceptTransfer(packageName: string): Promise<AcceptTransfer>;
331
+ cancelTransfer(packageName: string): Promise<CancelTransfer>;
332
+ getScope(scopeName: string): Promise<GetScope>;
333
+ getScopeOwner(scopeName: string): Promise<GetScopeOwner>;
334
+ getPackage(packageName: string): Promise<GetPackage>;
335
+ getOwner(packageName: string): Promise<GetOwner>;
336
+ getVersion(packageName: string, version: string): Promise<GetVersion>;
337
+ isDeprecated(packageName: string, version: string): Promise<IsDeprecated>;
338
+ isImmutable(packageName: string, version: string): Promise<IsImmutable>;
339
+ getPendingTransfer(packageName: string): Promise<GetPendingTransfer>;
340
+ getPendingScopeTransfer(scopeName: string): Promise<GetPendingScopeTransfer>;
341
+ getTreasuryAddress(): Promise<GetTreasuryAddress>;
342
+ getScopePrice(): Promise<GetScopePrice>;
343
+ getPackagePrice(): Promise<GetPackagePrice>;
344
+ }