@helium/helium-admin-cli 0.7.10 → 0.7.12
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/lib/cjs/create-and-approve-makers.js +323 -0
- package/lib/cjs/create-and-approve-makers.js.map +1 -0
- package/lib/cjs/create-maker.js +122 -213
- package/lib/cjs/create-maker.js.map +1 -1
- package/lib/esm/src/create-and-approve-makers.js +282 -0
- package/lib/esm/src/create-and-approve-makers.js.map +1 -0
- package/lib/esm/src/create-maker.js +131 -222
- package/lib/esm/src/create-maker.js.map +1 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/create-and-approve-makers.d.ts +2 -0
- package/lib/types/src/create-and-approve-makers.d.ts.map +1 -0
- package/lib/types/src/create-maker.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -1,84 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import os from 'os';
|
|
12
|
-
import yargs from 'yargs/yargs';
|
|
13
|
-
import { exists, loadKeypair, sendInstructionsOrSquads, merkleSizes, } from './utils';
|
|
14
|
-
import Squads from '@sqds/sdk';
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { init as initHem, makerKey } from "@helium/helium-entity-manager-sdk";
|
|
3
|
+
import { daoKey } from "@helium/helium-sub-daos-sdk";
|
|
4
|
+
import { HNT_MINT, humanReadable, sendInstructions, truthy, withPriorityFees } from "@helium/spl-utils";
|
|
5
|
+
import { SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, getConcurrentMerkleTreeAccountSize, } from "@solana/spl-account-compression";
|
|
6
|
+
import { Keypair, PublicKey, SystemProgram, } from "@solana/web3.js";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import os from "os";
|
|
9
|
+
import yargs from "yargs/yargs";
|
|
10
|
+
import { exists, loadKeypair, merkleSizes } from "./utils";
|
|
15
11
|
export async function run(args = process.argv) {
|
|
16
12
|
const yarg = yargs(args).options({
|
|
17
13
|
wallet: {
|
|
18
|
-
alias:
|
|
19
|
-
describe:
|
|
14
|
+
alias: "k",
|
|
15
|
+
describe: "Anchor wallet keypair",
|
|
20
16
|
default: `${os.homedir()}/.config/solana/id.json`,
|
|
21
17
|
},
|
|
22
|
-
executeTransaction: {
|
|
23
|
-
type: 'boolean',
|
|
24
|
-
},
|
|
25
18
|
url: {
|
|
26
|
-
alias:
|
|
27
|
-
default:
|
|
28
|
-
describe:
|
|
19
|
+
alias: "u",
|
|
20
|
+
default: "http://127.0.0.1:8899",
|
|
21
|
+
describe: "The solana url",
|
|
29
22
|
},
|
|
30
|
-
|
|
23
|
+
name: {
|
|
24
|
+
alias: "n",
|
|
25
|
+
type: "string",
|
|
31
26
|
required: true,
|
|
32
|
-
describe:
|
|
33
|
-
type: 'string',
|
|
27
|
+
describe: "The name of the maker",
|
|
34
28
|
},
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
describe:
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
fromFile: {
|
|
41
|
-
describe: 'Load makers from a json file and create in bulk',
|
|
42
|
-
required: false,
|
|
43
|
-
type: 'string',
|
|
29
|
+
issuingAuthority: {
|
|
30
|
+
type: "string",
|
|
31
|
+
describe: "Key that can issue hotspots on behalf of this maker",
|
|
32
|
+
required: true,
|
|
44
33
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
required:
|
|
49
|
-
describe: 'The name of the maker',
|
|
34
|
+
updateAuthority: {
|
|
35
|
+
type: "string",
|
|
36
|
+
describe: "Key that can update the maker's issuing authority",
|
|
37
|
+
required: true,
|
|
50
38
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
required: false,
|
|
39
|
+
metadataUrl: {
|
|
40
|
+
type: "string",
|
|
41
|
+
describe: "URL to metadata for this maker. Should be JSON with at least { name, image, description }",
|
|
42
|
+
required: true,
|
|
56
43
|
},
|
|
57
44
|
makerCount: {
|
|
58
|
-
alias:
|
|
59
|
-
type:
|
|
60
|
-
describe:
|
|
61
|
-
required: false,
|
|
62
|
-
},
|
|
63
|
-
merkleBasePath: {
|
|
64
|
-
type: 'string',
|
|
65
|
-
describe: 'Base path for merkle keypairs',
|
|
66
|
-
default: `${__dirname}/../keypairs`,
|
|
67
|
-
},
|
|
68
|
-
symbol: {
|
|
69
|
-
alias: 's',
|
|
70
|
-
type: 'string',
|
|
45
|
+
alias: "c",
|
|
46
|
+
type: "number",
|
|
47
|
+
describe: "Estimated number of hotspots this maker will have",
|
|
71
48
|
required: true,
|
|
72
|
-
describe: 'The symbol of the entity config',
|
|
73
49
|
},
|
|
74
|
-
|
|
75
|
-
type:
|
|
76
|
-
describe:
|
|
77
|
-
|
|
78
|
-
authorityIndex: {
|
|
79
|
-
type: 'number',
|
|
80
|
-
describe: 'Authority index for squads. Defaults to 1',
|
|
81
|
-
default: 1,
|
|
50
|
+
merkleBasePath: {
|
|
51
|
+
type: "string",
|
|
52
|
+
describe: "Base path for merkle keypairs",
|
|
53
|
+
default: `${__dirname}`,
|
|
82
54
|
},
|
|
83
55
|
});
|
|
84
56
|
const argv = await yarg.argv;
|
|
@@ -86,96 +58,99 @@ export async function run(args = process.argv) {
|
|
|
86
58
|
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
87
59
|
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
88
60
|
const provider = anchor.getProvider();
|
|
89
|
-
const wallet = new anchor.Wallet(loadKeypair(argv.wallet));
|
|
90
61
|
const name = argv.name;
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
name,
|
|
95
|
-
address: argv.makerKey,
|
|
96
|
-
count: argv.makerCount || 300000,
|
|
97
|
-
staked: true,
|
|
98
|
-
},
|
|
99
|
-
];
|
|
100
|
-
if (argv.fromFile) {
|
|
101
|
-
makers = JSON.parse(fs.readFileSync(argv.fromFile, 'utf-8'));
|
|
102
|
-
// Append a special fallthrough maker for hotspots that don't have a maker
|
|
103
|
-
const solAddr = provider.wallet.publicKey;
|
|
104
|
-
const helAddr = new Address(0, 0, ED25519_KEY_TYPE, solAddr.toBuffer());
|
|
105
|
-
makers.push({
|
|
106
|
-
name: 'Migrated Helium Hotspot',
|
|
107
|
-
address: helAddr.b58,
|
|
108
|
-
count: 50000,
|
|
109
|
-
staked: true,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
62
|
+
const count = argv.makerCount;
|
|
63
|
+
const issuingAuthority = new PublicKey(argv.issuingAuthority);
|
|
64
|
+
const updateAuthority = new PublicKey(argv.updateAuthority);
|
|
112
65
|
const hemProgram = await initHem(provider);
|
|
113
|
-
const hsdProgram = await initHsd(provider);
|
|
114
|
-
const vsrProgram = await initVsr(provider);
|
|
115
66
|
const conn = provider.connection;
|
|
116
|
-
const
|
|
117
|
-
const subdao = (await subDaoKey(subdaoMint))[0];
|
|
118
|
-
const entityConfigKey = (await rewardableEntityConfigKey(subdao, symbol.toUpperCase()))[0];
|
|
119
|
-
const subdaoAcc = await hsdProgram.account.subDaoV0.fetch(subdao);
|
|
120
|
-
const dao = await hsdProgram.account.daoV0.fetch(subdaoAcc.dao);
|
|
121
|
-
let subdaoPayer = provider.wallet.publicKey;
|
|
67
|
+
const daoK = daoKey(HNT_MINT)[0];
|
|
122
68
|
let daoPayer = provider.wallet.publicKey;
|
|
123
|
-
const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, wallet, {
|
|
124
|
-
commitmentOrConfig: 'finalized',
|
|
125
|
-
});
|
|
126
|
-
let authority = provider.wallet.publicKey;
|
|
127
|
-
let multisig = argv.multisig ? new PublicKey(argv.multisig) : null;
|
|
128
|
-
if (multisig) {
|
|
129
|
-
authority = squads.getAuthorityPDA(multisig, argv.authorityIndex);
|
|
130
|
-
subdaoPayer = authority;
|
|
131
|
-
daoPayer = authority;
|
|
132
|
-
console.log('SQUAD AUTH', authority.toBase58());
|
|
133
|
-
}
|
|
134
|
-
const createInstructions = [];
|
|
135
|
-
const approveInstructions = [];
|
|
136
|
-
const updateAuthority = dao.authority;
|
|
137
69
|
let totalSol = 0;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Solana addr: ${makerAuthority.toBase58()}.
|
|
159
|
-
Size: ${size}, buffer: ${buffer}, canopy: ${canopy}.
|
|
70
|
+
const instructions = [];
|
|
71
|
+
const [size, buffer, canopy] = merkleSizes.find(([height]) => Math.pow(2, height) > count * 2);
|
|
72
|
+
const space = getConcurrentMerkleTreeAccountSize(size, buffer, canopy);
|
|
73
|
+
const maker = await makerKey(daoK, name)[0];
|
|
74
|
+
const rent = await provider.connection.getMinimumBalanceForRentExemption(space);
|
|
75
|
+
totalSol += rent;
|
|
76
|
+
let merkle;
|
|
77
|
+
const merklePath = `${argv.merkleBasePath}/merkle-${maker.toBase58()}.json`;
|
|
78
|
+
if (fs.existsSync(merklePath)) {
|
|
79
|
+
merkle = loadKeypair(merklePath);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
merkle = Keypair.generate();
|
|
83
|
+
fs.writeFileSync(merklePath, JSON.stringify(Array.from(merkle.secretKey)));
|
|
84
|
+
}
|
|
85
|
+
if (!(await exists(conn, maker))) {
|
|
86
|
+
console.log(`
|
|
87
|
+
Creating maker with address: ${maker.toBase58()}
|
|
88
|
+
Issuing Authority: ${issuingAuthority.toBase58()}.
|
|
89
|
+
Capacity: 2^${size}, buffer: ${buffer}, canopy: ${canopy}.
|
|
160
90
|
Space: ${space} bytes
|
|
161
91
|
Cost: ~${humanReadable(new anchor.BN(rent), 9)} Sol
|
|
162
92
|
`);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
93
|
+
if (space > 10000000) {
|
|
94
|
+
throw new Error(`Space ${space} more than 10mb for tree ${size}, ${buffer}, ${canopy}}`);
|
|
95
|
+
}
|
|
96
|
+
const create = await hemProgram.methods
|
|
97
|
+
.initializeMakerV0({
|
|
98
|
+
name: name,
|
|
99
|
+
metadataUrl: argv.metadataUrl,
|
|
100
|
+
issuingAuthority,
|
|
101
|
+
// Temp, since we need to set maker tree
|
|
102
|
+
updateAuthority: provider.wallet.publicKey,
|
|
103
|
+
})
|
|
104
|
+
.accounts({
|
|
105
|
+
maker,
|
|
106
|
+
payer: daoPayer,
|
|
107
|
+
dao: daoK,
|
|
108
|
+
})
|
|
109
|
+
.instruction();
|
|
110
|
+
const setTree = await hemProgram.methods
|
|
111
|
+
.setMakerTreeV0({
|
|
112
|
+
maxDepth: size,
|
|
113
|
+
maxBufferSize: buffer,
|
|
114
|
+
})
|
|
115
|
+
.accounts({
|
|
116
|
+
maker,
|
|
117
|
+
merkleTree: merkle.publicKey,
|
|
118
|
+
payer: daoPayer,
|
|
119
|
+
updateAuthority: provider.wallet.publicKey,
|
|
120
|
+
})
|
|
121
|
+
.instruction();
|
|
122
|
+
if (!(await exists(conn, merkle.publicKey))) {
|
|
123
|
+
await sendInstructions(provider, [
|
|
124
|
+
SystemProgram.createAccount({
|
|
125
|
+
fromPubkey: provider.wallet.publicKey,
|
|
126
|
+
newAccountPubkey: merkle.publicKey,
|
|
127
|
+
lamports: await provider.connection.getMinimumBalanceForRentExemption(space),
|
|
128
|
+
space: space,
|
|
129
|
+
programId: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID,
|
|
130
|
+
}),
|
|
131
|
+
], [merkle]);
|
|
132
|
+
}
|
|
133
|
+
instructions.push(...[create, setTree].filter(truthy));
|
|
134
|
+
if (!updateAuthority.equals(provider.wallet.publicKey)) {
|
|
135
|
+
instructions.push(await hemProgram.methods
|
|
136
|
+
.updateMakerV0({
|
|
137
|
+
issuingAuthority,
|
|
171
138
|
updateAuthority,
|
|
172
139
|
})
|
|
173
|
-
.accounts({
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
140
|
+
.accounts({ maker, updateAuthority: provider.wallet.publicKey })
|
|
141
|
+
.instruction());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const makerAcc = await hemProgram.account.makerV0.fetch(maker);
|
|
146
|
+
instructions.push(await hemProgram.methods
|
|
147
|
+
.updateMakerV0({
|
|
148
|
+
issuingAuthority,
|
|
149
|
+
updateAuthority,
|
|
150
|
+
})
|
|
151
|
+
.accounts({ maker, updateAuthority: makerAcc.updateAuthority })
|
|
152
|
+
.instruction());
|
|
153
|
+
if (makerAcc.merkleTree.equals(SystemProgram.programId)) {
|
|
179
154
|
const setTree = await hemProgram.methods
|
|
180
155
|
.setMakerTreeV0({
|
|
181
156
|
maxDepth: size,
|
|
@@ -199,84 +174,18 @@ export async function run(args = process.argv) {
|
|
|
199
174
|
}),
|
|
200
175
|
], [merkle]);
|
|
201
176
|
}
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
const makerAcc = await hemProgram.account.makerV0.fetch(maker);
|
|
206
|
-
innerCreateInstrs.push(await hemProgram.methods
|
|
207
|
-
.updateMakerV0({
|
|
208
|
-
issuingAuthority: makerAuthority,
|
|
209
|
-
updateAuthority,
|
|
210
|
-
})
|
|
211
|
-
.accounts({ maker, updateAuthority: makerAcc.updateAuthority })
|
|
212
|
-
.instruction());
|
|
213
|
-
if (makerAcc.merkleTree.equals(SystemProgram.programId)) {
|
|
214
|
-
const setTree = await hemProgram.methods
|
|
215
|
-
.setMakerTreeV0({
|
|
216
|
-
maxDepth: size,
|
|
217
|
-
maxBufferSize: buffer,
|
|
218
|
-
})
|
|
219
|
-
.accounts({
|
|
220
|
-
maker,
|
|
221
|
-
merkleTree: merkle.publicKey,
|
|
222
|
-
payer: daoPayer,
|
|
223
|
-
updateAuthority,
|
|
224
|
-
})
|
|
225
|
-
.instruction();
|
|
226
|
-
if (!(await exists(conn, merkle.publicKey))) {
|
|
227
|
-
await sendInstructions(provider, [
|
|
228
|
-
SystemProgram.createAccount({
|
|
229
|
-
fromPubkey: provider.wallet.publicKey,
|
|
230
|
-
newAccountPubkey: merkle.publicKey,
|
|
231
|
-
lamports: await provider.connection.getMinimumBalanceForRentExemption(space),
|
|
232
|
-
space: space,
|
|
233
|
-
programId: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID,
|
|
234
|
-
}),
|
|
235
|
-
], [merkle]);
|
|
236
|
-
}
|
|
237
|
-
innerCreateInstrs.push(setTree);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
createInstructions.push(innerCreateInstrs);
|
|
241
|
-
const innerApproveInstrs = [];
|
|
242
|
-
let approve;
|
|
243
|
-
if (staked &&
|
|
244
|
-
!(await exists(conn, makerApprovalKey(entityConfigKey, maker)[0]))) {
|
|
245
|
-
const authority = (await hemProgram.account.rewardableEntityConfigV0.fetch(entityConfigKey)).authority;
|
|
246
|
-
approve = await hemProgram.methods
|
|
247
|
-
.approveMakerV0()
|
|
248
|
-
.accounts({
|
|
249
|
-
maker,
|
|
250
|
-
rewardableEntityConfig: entityConfigKey,
|
|
251
|
-
authority,
|
|
252
|
-
payer: subdaoPayer,
|
|
253
|
-
})
|
|
254
|
-
.instruction();
|
|
255
|
-
innerApproveInstrs.push(approve);
|
|
256
|
-
}
|
|
257
|
-
approveInstructions.push(innerApproveInstrs);
|
|
258
|
-
}
|
|
259
|
-
console.log('Total sol needed: ', humanReadable(new anchor.BN(totalSol), 9));
|
|
260
|
-
if (multisig) {
|
|
261
|
-
// Approve instructions must execute after ALL create instructions
|
|
262
|
-
const instrs = createInstructions.flat().filter(truthy);
|
|
263
|
-
const approveInstrs = approveInstructions.flat().filter(truthy);
|
|
264
|
-
for (const chunk of chunks([...instrs, ...approveInstrs], 3)) {
|
|
265
|
-
await sendInstructionsOrSquads({
|
|
266
|
-
provider,
|
|
267
|
-
instructions: chunk,
|
|
268
|
-
signers: [],
|
|
269
|
-
executeTransaction: argv.executeTransaction,
|
|
270
|
-
squads,
|
|
271
|
-
multisig,
|
|
272
|
-
authorityIndex: argv.authorityIndex,
|
|
273
|
-
});
|
|
177
|
+
instructions.push(setTree);
|
|
274
178
|
}
|
|
275
179
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
180
|
+
console.log("Total sol needed: ", humanReadable(new anchor.BN(totalSol), 9));
|
|
181
|
+
const balance = await provider.connection.getBalance(provider.wallet.publicKey);
|
|
182
|
+
if (balance < totalSol) {
|
|
183
|
+
throw new Error(`Insufficient balance: ${humanReadable(new anchor.BN(Math.floor(balance)), 9)} < ${humanReadable(new anchor.BN(totalSol), 9)}`);
|
|
280
184
|
}
|
|
185
|
+
await sendInstructions(provider, await withPriorityFees({
|
|
186
|
+
connection: provider.connection,
|
|
187
|
+
instructions,
|
|
188
|
+
feePayer: provider.wallet.publicKey
|
|
189
|
+
}));
|
|
281
190
|
}
|
|
282
191
|
//# sourceMappingURL=create-maker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-maker.js","sourceRoot":"","sources":["../../../src/create-maker.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-maker.js","sourceRoot":"","sources":["../../../src/create-maker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,IAAI,IAAI,OAAO,EACf,QAAQ,EACT,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,MAAM,EAEP,MAAM,6BAA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