@helium/helium-admin-cli 0.11.17 → 0.11.19
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/close-council-fanout.js +142 -0
- package/lib/cjs/close-council-fanout.js.map +1 -0
- package/lib/cjs/create-council-fanout.js +69 -14
- package/lib/cjs/create-council-fanout.js.map +1 -1
- package/lib/cjs/end-epoch.js +34 -2
- package/lib/cjs/end-epoch.js.map +1 -1
- package/lib/cjs/hip149.js +13 -0
- package/lib/cjs/hip149.js.map +1 -0
- package/lib/cjs/mini-fanout-utils.js +57 -0
- package/lib/cjs/mini-fanout-utils.js.map +1 -0
- package/lib/cjs/queue-hotspot-claims.js +2 -6
- package/lib/cjs/queue-hotspot-claims.js.map +1 -1
- package/lib/cjs/queue-position-claims.js +1 -3
- package/lib/cjs/queue-position-claims.js.map +1 -1
- package/lib/cjs/requeue-hotspot-claims.js +1 -3
- package/lib/cjs/requeue-hotspot-claims.js.map +1 -1
- package/lib/cjs/reschedule-all-mini-fanouts.js +38 -14
- package/lib/cjs/reschedule-all-mini-fanouts.js.map +1 -1
- package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/cjs/update-council-fanout.js +177 -0
- package/lib/cjs/update-council-fanout.js.map +1 -0
- package/lib/cjs/update-data-credits.js +12 -12
- package/lib/esm/src/close-council-fanout.js +92 -0
- package/lib/esm/src/close-council-fanout.js.map +1 -0
- package/lib/esm/src/create-council-fanout.js +69 -14
- package/lib/esm/src/create-council-fanout.js.map +1 -1
- package/lib/esm/src/end-epoch.js +35 -3
- package/lib/esm/src/end-epoch.js.map +1 -1
- package/lib/esm/src/hip149.js +10 -0
- package/lib/esm/src/hip149.js.map +1 -0
- package/lib/esm/src/mini-fanout-utils.js +40 -0
- package/lib/esm/src/mini-fanout-utils.js.map +1 -0
- package/lib/esm/src/queue-hotspot-claims.js +2 -6
- package/lib/esm/src/queue-hotspot-claims.js.map +1 -1
- package/lib/esm/src/queue-position-claims.js +1 -3
- package/lib/esm/src/queue-position-claims.js.map +1 -1
- package/lib/esm/src/requeue-hotspot-claims.js +1 -3
- package/lib/esm/src/requeue-hotspot-claims.js.map +1 -1
- package/lib/esm/src/reschedule-all-mini-fanouts.js +39 -15
- package/lib/esm/src/reschedule-all-mini-fanouts.js.map +1 -1
- package/lib/esm/src/update-council-fanout.js +126 -0
- package/lib/esm/src/update-council-fanout.js.map +1 -0
- package/lib/esm/src/update-data-credits.js +18 -18
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/close-council-fanout.d.ts +2 -0
- package/lib/types/src/close-council-fanout.d.ts.map +1 -0
- package/lib/types/src/create-council-fanout.d.ts.map +1 -1
- package/lib/types/src/end-epoch.d.ts.map +1 -1
- package/lib/types/src/hip149.d.ts +4 -0
- package/lib/types/src/hip149.d.ts.map +1 -0
- package/lib/types/src/mini-fanout-utils.d.ts +25 -0
- package/lib/types/src/mini-fanout-utils.d.ts.map +1 -0
- package/lib/types/src/queue-hotspot-claims.d.ts.map +1 -1
- package/lib/types/src/queue-position-claims.d.ts.map +1 -1
- package/lib/types/src/requeue-hotspot-claims.d.ts.map +1 -1
- package/lib/types/src/reschedule-all-mini-fanouts.d.ts.map +1 -1
- package/lib/types/src/update-council-fanout.d.ts +2 -0
- package/lib/types/src/update-council-fanout.d.ts.map +1 -0
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requeue-hotspot-claims.js","sourceRoot":"","sources":["../../src/requeue-hotspot-claims.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,
|
|
1
|
+
{"version":3,"file":"requeue-hotspot-claims.js","sourceRoot":"","sources":["../../src/requeue-hotspot-claims.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,kBAgEC;AApFD,0DAA4C;AAC5C,+CA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H,CAAC;CAAA"}
|
|
@@ -51,6 +51,7 @@ const hpl_crons_sdk_1 = require("@helium/hpl-crons-sdk");
|
|
|
51
51
|
const mini_fanout_sdk_1 = require("@helium/mini-fanout-sdk");
|
|
52
52
|
const spl_utils_1 = require("@helium/spl-utils");
|
|
53
53
|
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
54
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
54
55
|
const os_1 = __importDefault(require("os"));
|
|
55
56
|
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
56
57
|
const utils_1 = require("./utils");
|
|
@@ -67,6 +68,10 @@ function run() {
|
|
|
67
68
|
default: "http://127.0.0.1:8899",
|
|
68
69
|
describe: "The solana url",
|
|
69
70
|
},
|
|
71
|
+
miniFanout: {
|
|
72
|
+
type: "string",
|
|
73
|
+
describe: "Reschedule only this mini fanout instead of every mini fanout on the network. Use this to recover a single fanout (e.g. the council fanout) that went idle after running out of lamports, without touching anyone else's.",
|
|
74
|
+
},
|
|
70
75
|
});
|
|
71
76
|
const argv = yield yarg.argv;
|
|
72
77
|
process.env.ANCHOR_WALLET = argv.wallet;
|
|
@@ -77,28 +82,47 @@ function run() {
|
|
|
77
82
|
const program = yield (0, mini_fanout_sdk_1.init)(provider);
|
|
78
83
|
const tuktukProgram = yield (0, tuktuk_sdk_1.init)(provider);
|
|
79
84
|
const instructions = [];
|
|
80
|
-
const
|
|
85
|
+
const allMiniFanouts = yield program.account.miniFanoutV0.all();
|
|
86
|
+
const miniFanouts = argv.miniFanout
|
|
87
|
+
? allMiniFanouts.filter((mf) => mf.publicKey.equals(new web3_js_1.PublicKey(argv.miniFanout)))
|
|
88
|
+
: allMiniFanouts;
|
|
89
|
+
if (argv.miniFanout && miniFanouts.length === 0) {
|
|
90
|
+
throw new Error(`No mini fanout found at ${argv.miniFanout}`);
|
|
91
|
+
}
|
|
92
|
+
// scheduleTaskV0 only accepts a fanout whose next_task/next_pre_task are
|
|
93
|
+
// already the "nothing scheduled" sentinel (pointing at the fanout itself,
|
|
94
|
+
// or legacy: at the program id) -- see its on-chain constraint. Anything
|
|
95
|
+
// else means a task is genuinely still live, and dequeuing a live task
|
|
96
|
+
// requires a CPI signature from the mini-fanout program's own
|
|
97
|
+
// queue_authority PDA (see queue_authority_seeds! in state.rs), which only
|
|
98
|
+
// update_mini_fanout_v0 / close_mini_fanout_v0 can produce -- both of which
|
|
99
|
+
// require the owner (governance multisig) to sign. There is no way to
|
|
100
|
+
// dequeue a live task from a bare client instruction, so don't try; skip
|
|
101
|
+
// and say so instead of submitting a transaction guaranteed to fail on a
|
|
102
|
+
// missing signature.
|
|
103
|
+
const isIdleSentinel = (miniFanout, task) => task.equals(program.programId) || task.equals(miniFanout.publicKey);
|
|
104
|
+
const idle = miniFanouts.filter((mf) => {
|
|
105
|
+
const ok = isIdleSentinel(mf, mf.account.nextTask) &&
|
|
106
|
+
isIdleSentinel(mf, mf.account.nextPreTask);
|
|
107
|
+
if (!ok) {
|
|
108
|
+
console.log(`Skipping ${mf.publicKey.toBase58()}: still has a live scheduled task; ` +
|
|
109
|
+
`use update-council-fanout.ts (owner-signed) to reschedule it instead.`);
|
|
110
|
+
}
|
|
111
|
+
return ok;
|
|
112
|
+
});
|
|
81
113
|
const batchSize = 10;
|
|
82
114
|
const taskQueue = yield tuktukProgram.account.taskQueueV0.fetch(hpl_crons_sdk_1.TASK_QUEUE_ID);
|
|
83
|
-
const freeTasks = (0, tuktuk_sdk_1.nextAvailableTaskIds)(taskQueue.taskBitmap,
|
|
84
|
-
for (let i = 0; i <
|
|
115
|
+
const freeTasks = (0, tuktuk_sdk_1.nextAvailableTaskIds)(taskQueue.taskBitmap, idle.length * 2);
|
|
116
|
+
for (let i = 0; i < idle.length; i += batchSize) {
|
|
85
117
|
// Log progress every 100 positions
|
|
86
118
|
if (i > 0 && i % 100 === 0) {
|
|
87
119
|
console.log(`Processed ${i} mini fanouts`);
|
|
88
120
|
}
|
|
89
|
-
const batch =
|
|
121
|
+
const batch = idle.slice(i, i + batchSize);
|
|
90
122
|
yield Promise.all(batch.map((miniFanout) => __awaiter(this, void 0, void 0, function* () {
|
|
91
123
|
const nextTask = freeTasks.pop();
|
|
92
124
|
const nextPreTask = freeTasks.pop();
|
|
93
|
-
const nextTaskAcc = miniFanout.account.nextTask.equals(program.programId) || miniFanout.account.nextTask.equals(miniFanout.publicKey) ? undefined : yield tuktukProgram.account.taskV0.fetchNullable(miniFanout.account.nextTask);
|
|
94
|
-
const nextPreTaskAcc = miniFanout.account.nextPreTask.equals(program.programId) || miniFanout.account.nextPreTask.equals(miniFanout.publicKey) ? undefined : yield tuktukProgram.account.taskV0.fetchNullable(miniFanout.account.nextPreTask);
|
|
95
125
|
instructions.push([
|
|
96
|
-
nextTaskAcc ? yield tuktukProgram.methods.dequeueTaskV0().accounts({
|
|
97
|
-
task: miniFanout.account.nextTask,
|
|
98
|
-
}).instruction() : undefined,
|
|
99
|
-
nextPreTaskAcc ? yield tuktukProgram.methods.dequeueTaskV0().accounts({
|
|
100
|
-
task: miniFanout.account.nextPreTask,
|
|
101
|
-
}).instruction() : undefined,
|
|
102
126
|
yield program.methods.scheduleTaskV0({
|
|
103
127
|
taskId: nextTask,
|
|
104
128
|
preTaskId: nextPreTask,
|
|
@@ -110,10 +134,10 @@ function run() {
|
|
|
110
134
|
preTask: (0, tuktuk_sdk_1.taskKey)(hpl_crons_sdk_1.TASK_QUEUE_ID, nextPreTask)[0],
|
|
111
135
|
})
|
|
112
136
|
.instruction()
|
|
113
|
-
]
|
|
137
|
+
]);
|
|
114
138
|
})));
|
|
115
139
|
}
|
|
116
|
-
console.log(`Finished processing ${
|
|
140
|
+
console.log(`Finished processing ${idle.length} mini fanouts (${miniFanouts.length - idle.length} skipped as not idle)`);
|
|
117
141
|
const transactions = yield (0, spl_utils_1.batchInstructionsToTxsWithPriorityFee)(provider, instructions, {
|
|
118
142
|
useFirstEstimateForAll: true,
|
|
119
143
|
computeUnitLimit: 1200000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reschedule-all-mini-fanouts.js","sourceRoot":"","sources":["../../src/reschedule-all-mini-fanouts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"reschedule-all-mini-fanouts.js","sourceRoot":"","sources":["../../src/reschedule-all-mini-fanouts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,kBA6GC;AAvHD,0DAA4C;AAC5C,yDAAsD;AACtD,6DAA2D;AAC3D,iDAAgG;AAChG,mDAAuF;AACvF,6CAAoE;AACpE,4CAAoB;AACpB,wDAAgC;AAChC,mCAAsC;AAEtC,SAAsB,GAAG;yDAAC,OAAY,OAAO,CAAC,IAAI;QAChD,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YAC/B,MAAM,EAAE;gBACN,KAAK,EAAE,GAAG;gBACV,QAAQ,EAAE,uBAAuB;gBACjC,OAAO,EAAE,GAAG,YAAE,CAAC,OAAO,EAAE,yBAAyB;aAClD;YACD,GAAG,EAAE;gBACH,KAAK,EAAE,GAAG;gBACV,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,gBAAgB;aAC3B;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EACN,2NAA2N;aAC9N;SACF,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC;QAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,M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OAAO,CAAC,cAAc,CAAC;wBACnC,MAAM,EAAE,QAAQ;wBAChB,SAAS,EAAE,WAAW;qBACvB,CAAC;yBACC,QAAQ,CAAC;wBACR,KAAK,EAAE,MAAM,CAAC,SAAS;wBACvB,UAAU,EAAE,UAAU,CAAC,SAAS;wBAChC,IAAI,EAAE,IAAA,oBAAO,EAAC,6BAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;wBACzC,OAAO,EAAE,IAAA,oBAAO,EAAC,6BAAa,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;qBAChD,CAAC;yBACD,WAAW,EAAE;iBACjB,CAAC,CAAC;YACL,CAAC,CAAA,CAAC,CAAC,CAAC;QACN,CAAC;QACD,OAAO,CAAC,GAAG,CACT,uBAAuB,IAAI,CAAC,MAAM,kBAChC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,MAC5B,uBAAuB,CACxB,CAAC;QAEF,MAAM,YAAY,GAAG,MAAM,IAAA,iDAAqC,EAC9D,QAAQ,EACR,YAAY,EACZ;YACE,sBAAsB,EAAE,IAAI;YAC5B,gBAAgB,EAAE,OAAO;SAC1B,CACF,CAAC;QAEF,MAAM,IAAA,gCAAoB,EAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAC/E,CAAC;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../src/add-expiration-to-delegations.ts","../../src/add-squads-proposer.ts","../../src/approve-carrier.ts","../../src/approve-maker.ts","../../src/approve-program.ts","../../src/backfill-mobile-deployment-infos.ts","../../src/backfill-recent-proposals.ts","../../src/backfill-vote-markers.ts","../../src/claim-rewards.ts","../../src/close-auto-topoff.ts","../../src/close-buffers.ts","../../src/close-canopy.ts","../../src/close-expired-boosts.ts","../../src/close-lazy-transaction-markers.ts","../../src/close-legacy-auto-topoff.ts","../../src/correct-router-dc.ts","../../src/count-active-hotspots.ts","../../src/create-and-approve-makers.ts","../../src/create-boost-config.ts","../../src/create-carrier.ts","../../src/create-common-lut.ts","../../src/create-council-fanout.ts","../../src/create-dao.ts","../../src/create-data-only-config.ts","../../src/create-maker.ts","../../src/create-price-oracle.ts","../../src/create-subdao.ts","../../src/create-tuktuk-dca-lut.ts","../../src/distribute-hst.ts","../../src/distribute-iot-operations-fund.ts","../../src/dump-vote-markers.ts","../../src/ecc-gen.ts","../../src/end-epoch.ts","../../src/execute-vault-transaction.ts","../../src/extend-common-lut.ts","../../src/get-merkle-depths.ts","../../src/get-staked-wallets.ts","../../src/initialize-tuktuk-dca.ts","../../src/is-executed.ts","../../src/issue-carrier-nft.ts","../../src/issue-iot-operations-fund.ts","../../src/issue-mapping-rewards-nft.ts","../../src/issue-service-rewards-nft.ts","../../src/issue-test-hotspot.ts","../../src/log-coingecko-price.ts","../../src/log-hotspot.ts","../../src/log-router-balance.ts","../../src/log-treasury-price.ts","../../src/mint-dc.ts","../../src/queue-hotspot-claims.ts","../../src/queue-position-claims.ts","../../src/queue-proxy-jobs.ts","../../src/queue-wallet-claims.ts","../../src/release-iot-mobile-positions.ts","../../src/repair-all-position-claims.ts","../../src/requeue-hotspot-claims.ts","../../src/reschedule-all-mini-fanouts.ts","../../src/reset-vsr-voting-mint.ts","../../src/revoke-maker.ts","../../src/set-dc-onboarding-fees-paid-epoch-info.ts","../../src/set-dc-onboarding-fees-paid.ts","../../src/set-proxy-config.ts","../../src/setup-dc-auto-topoff.ts","../../src/setup-hst.ts","../../src/squads-batch-optimizer.ts","../../src/start-cron.ts","../../src/submit-price.ts","../../src/sum-tokens.ts","../../src/swap-carrier-stake.ts","../../src/swap-maker-stake.ts","../../src/switch-mobile-ops-fund.ts","../../src/take-snapshot.ts","../../src/transfer-program-authorities.ts","../../src/unrug-hotspots.ts","../../src/update-account-circuit-breaker.ts","../../src/update-boost-config.ts","../../src/update-carrier.ts","../../src/update-dao.ts","../../src/update-data-credits.ts","../../src/update-delegated-dc-subdao.ts","../../src/update-destinations.ts","../../src/update-lazy-distributor.ts","../../src/update-lazy-transactions.ts","../../src/update-maker.ts","../../src/update-matching-destinations.ts","../../src/update-mint-circuit-breaker.ts","../../src/update-organization.ts","../../src/update-price-oracle.ts","../../src/update-proxy-config.ts","../../src/update-registrar-authorities.ts","../../src/update-rewardable-entity-config.ts","../../src/update-subdao-vehnt.ts","../../src/update-subdao.ts","../../src/update-token-metadata.ts","../../src/upgrade-idl.ts","../../src/upsert-incentive-program.ts","../../src/utils.ts","../../src/write-merkle-canopy-depths.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../../src/add-expiration-to-delegations.ts","../../src/add-squads-proposer.ts","../../src/approve-carrier.ts","../../src/approve-maker.ts","../../src/approve-program.ts","../../src/backfill-mobile-deployment-infos.ts","../../src/backfill-recent-proposals.ts","../../src/backfill-vote-markers.ts","../../src/claim-rewards.ts","../../src/close-auto-topoff.ts","../../src/close-buffers.ts","../../src/close-canopy.ts","../../src/close-council-fanout.ts","../../src/close-expired-boosts.ts","../../src/close-lazy-transaction-markers.ts","../../src/close-legacy-auto-topoff.ts","../../src/correct-router-dc.ts","../../src/count-active-hotspots.ts","../../src/create-and-approve-makers.ts","../../src/create-boost-config.ts","../../src/create-carrier.ts","../../src/create-common-lut.ts","../../src/create-council-fanout.ts","../../src/create-dao.ts","../../src/create-data-only-config.ts","../../src/create-maker.ts","../../src/create-price-oracle.ts","../../src/create-subdao.ts","../../src/create-tuktuk-dca-lut.ts","../../src/distribute-hst.ts","../../src/distribute-iot-operations-fund.ts","../../src/dump-vote-markers.ts","../../src/ecc-gen.ts","../../src/end-epoch.ts","../../src/execute-vault-transaction.ts","../../src/extend-common-lut.ts","../../src/get-merkle-depths.ts","../../src/get-staked-wallets.ts","../../src/hip149.ts","../../src/initialize-tuktuk-dca.ts","../../src/is-executed.ts","../../src/issue-carrier-nft.ts","../../src/issue-iot-operations-fund.ts","../../src/issue-mapping-rewards-nft.ts","../../src/issue-service-rewards-nft.ts","../../src/issue-test-hotspot.ts","../../src/log-coingecko-price.ts","../../src/log-hotspot.ts","../../src/log-router-balance.ts","../../src/log-treasury-price.ts","../../src/mini-fanout-utils.ts","../../src/mint-dc.ts","../../src/queue-hotspot-claims.ts","../../src/queue-position-claims.ts","../../src/queue-proxy-jobs.ts","../../src/queue-wallet-claims.ts","../../src/release-iot-mobile-positions.ts","../../src/repair-all-position-claims.ts","../../src/requeue-hotspot-claims.ts","../../src/reschedule-all-mini-fanouts.ts","../../src/reset-vsr-voting-mint.ts","../../src/revoke-maker.ts","../../src/set-dc-onboarding-fees-paid-epoch-info.ts","../../src/set-dc-onboarding-fees-paid.ts","../../src/set-proxy-config.ts","../../src/setup-dc-auto-topoff.ts","../../src/setup-hst.ts","../../src/squads-batch-optimizer.ts","../../src/start-cron.ts","../../src/submit-price.ts","../../src/sum-tokens.ts","../../src/swap-carrier-stake.ts","../../src/swap-maker-stake.ts","../../src/switch-mobile-ops-fund.ts","../../src/take-snapshot.ts","../../src/transfer-program-authorities.ts","../../src/unrug-hotspots.ts","../../src/update-account-circuit-breaker.ts","../../src/update-boost-config.ts","../../src/update-carrier.ts","../../src/update-council-fanout.ts","../../src/update-dao.ts","../../src/update-data-credits.ts","../../src/update-delegated-dc-subdao.ts","../../src/update-destinations.ts","../../src/update-lazy-distributor.ts","../../src/update-lazy-transactions.ts","../../src/update-maker.ts","../../src/update-matching-destinations.ts","../../src/update-mint-circuit-breaker.ts","../../src/update-organization.ts","../../src/update-price-oracle.ts","../../src/update-proxy-config.ts","../../src/update-registrar-authorities.ts","../../src/update-rewardable-entity-config.ts","../../src/update-subdao-vehnt.ts","../../src/update-subdao.ts","../../src/update-token-metadata.ts","../../src/upgrade-idl.ts","../../src/upsert-incentive-program.ts","../../src/utils.ts","../../src/write-merkle-canopy-depths.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.run = run;
|
|
49
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
50
|
+
const mini_fanout_sdk_1 = require("@helium/mini-fanout-sdk");
|
|
51
|
+
const tuktuk_sdk_1 = require("@helium/tuktuk-sdk");
|
|
52
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
53
|
+
const os_1 = __importDefault(require("os"));
|
|
54
|
+
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
55
|
+
const mini_fanout_utils_1 = require("./mini-fanout-utils");
|
|
56
|
+
const utils_1 = require("./utils");
|
|
57
|
+
// HIP 149 Decision 4: update the Advisory Council compensation fanout created by
|
|
58
|
+
// create-council-fanout.ts. Use this on a seat change (add/remove a member) or to
|
|
59
|
+
// change the distribution schedule.
|
|
60
|
+
//
|
|
61
|
+
// Operational rules (see HIP 149 Decision 4, and the header comment on
|
|
62
|
+
// create-council-fanout.ts):
|
|
63
|
+
// - CRANK before running this on a seat change. `update_mini_fanout_v0` replaces
|
|
64
|
+
// the share vec wholesale, so accrual (total_owed) for members not carried
|
|
65
|
+
// forward is lost. Let the current period's distribution run first so accrual
|
|
66
|
+
// maps to the set that was actually seated when it accrued, then update.
|
|
67
|
+
// - The fanout's `owner` (a governance multisig vault) must sign this. Pass
|
|
68
|
+
// `--multisig <governance multisig address>` to route it through Squads V4
|
|
69
|
+
// as a proposal instead of trying to send it directly.
|
|
70
|
+
// - Omitting --members leaves the current share set untouched (only the
|
|
71
|
+
// schedule changes, if given). Omitting --schedule leaves the cron
|
|
72
|
+
// untouched. Passing neither still re-queues the next distribution task,
|
|
73
|
+
// which is a valid way to force a reschedule on an already-scheduled fanout
|
|
74
|
+
// (an idle/unscheduled one should use reschedule-all-mini-fanouts.ts instead,
|
|
75
|
+
// since that path doesn't need the owner's signature).
|
|
76
|
+
// - This instruction bakes in the fanout's *current* next_task/next_pre_task
|
|
77
|
+
// (has_one-checked on-chain) and a task id claimed from the queue's current
|
|
78
|
+
// bitmap at build time -- both can go stale while a Squads proposal sits
|
|
79
|
+
// waiting for approval (the cron can self-reschedule to a new next_task, or
|
|
80
|
+
// another queue_task_v0 call can claim the same id first). Either makes
|
|
81
|
+
// execution fail on-chain (has_one mismatch or TaskAlreadyExists) rather
|
|
82
|
+
// than corrupt anything, but the proposal is then permanently dead and must
|
|
83
|
+
// be rebuilt from a fresh run of this script. Get proposals approved
|
|
84
|
+
// promptly; if one sits for a while, re-run this script and re-propose
|
|
85
|
+
// rather than trusting a stale one to still execute.
|
|
86
|
+
function run() {
|
|
87
|
+
return __awaiter(this, arguments, void 0, function* (args = process.argv) {
|
|
88
|
+
var _a;
|
|
89
|
+
const yarg = (0, yargs_1.default)(args).options({
|
|
90
|
+
wallet: {
|
|
91
|
+
alias: "k",
|
|
92
|
+
describe: "Anchor wallet keypair (payer; proposer if using --multisig)",
|
|
93
|
+
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
94
|
+
},
|
|
95
|
+
url: {
|
|
96
|
+
alias: "u",
|
|
97
|
+
default: "http://127.0.0.1:8899",
|
|
98
|
+
describe: "The solana url",
|
|
99
|
+
},
|
|
100
|
+
miniFanout: {
|
|
101
|
+
type: "string",
|
|
102
|
+
required: true,
|
|
103
|
+
describe: "Address of the mini fanout to update",
|
|
104
|
+
},
|
|
105
|
+
members: {
|
|
106
|
+
type: "string",
|
|
107
|
+
describe: "Comma-separated seated community-member wallet addresses to replace the current share set with (each gets an equal share). Omit to leave shares unchanged.",
|
|
108
|
+
},
|
|
109
|
+
schedule: {
|
|
110
|
+
type: "string",
|
|
111
|
+
describe: "New cron schedule (sec min hour day month dow) for the distribution crank. Omit to leave the schedule unchanged.",
|
|
112
|
+
},
|
|
113
|
+
multisig: {
|
|
114
|
+
type: "string",
|
|
115
|
+
describe: "Address of the squads multisig to propose through. Required in practice, since the fanout owner is the governance multisig and must sign this update.",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
const argv = yield yarg.argv;
|
|
119
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
120
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
121
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
122
|
+
const provider = anchor.getProvider();
|
|
123
|
+
const wallet = new anchor.Wallet((0, utils_1.loadKeypair)(argv.wallet));
|
|
124
|
+
const program = yield (0, mini_fanout_sdk_1.init)(provider);
|
|
125
|
+
const tuktukProgram = yield (0, tuktuk_sdk_1.init)(provider);
|
|
126
|
+
const miniFanout = new web3_js_1.PublicKey(argv.miniFanout);
|
|
127
|
+
const miniFanoutAcc = yield program.account.miniFanoutV0.fetch(miniFanout);
|
|
128
|
+
const shares = argv.members
|
|
129
|
+
? argv.members
|
|
130
|
+
.split(",")
|
|
131
|
+
.map((m) => m.trim())
|
|
132
|
+
.filter(Boolean)
|
|
133
|
+
.map((m) => ({
|
|
134
|
+
wallet: new web3_js_1.PublicKey(m),
|
|
135
|
+
share: { share: { amount: 1 } },
|
|
136
|
+
}))
|
|
137
|
+
: null;
|
|
138
|
+
if (argv.members && shares.length === 0) {
|
|
139
|
+
throw new Error("--members was given but resolved to zero wallets");
|
|
140
|
+
}
|
|
141
|
+
const { taskId, preTaskId, task, preTask } = yield (0, mini_fanout_utils_1.allocateNextTasks)(tuktukProgram, miniFanoutAcc.taskQueue);
|
|
142
|
+
const taskRentRefund = yield (0, mini_fanout_utils_1.resolveTaskRentRefund)(tuktukProgram, miniFanoutAcc.nextTask, miniFanout, program.programId, wallet.publicKey);
|
|
143
|
+
const updateIx = yield program.methods
|
|
144
|
+
.updateMiniFanoutV0({
|
|
145
|
+
newTaskId: taskId,
|
|
146
|
+
newPreTaskId: preTaskId,
|
|
147
|
+
shares,
|
|
148
|
+
schedule: (_a = argv.schedule) !== null && _a !== void 0 ? _a : null,
|
|
149
|
+
})
|
|
150
|
+
.accountsPartial({
|
|
151
|
+
owner: miniFanoutAcc.owner,
|
|
152
|
+
payer: wallet.publicKey,
|
|
153
|
+
miniFanout,
|
|
154
|
+
taskQueue: miniFanoutAcc.taskQueue,
|
|
155
|
+
newTask: task,
|
|
156
|
+
newPreTask: preTask,
|
|
157
|
+
taskRentRefund,
|
|
158
|
+
})
|
|
159
|
+
.instruction();
|
|
160
|
+
yield (0, utils_1.sendInstructionsOrSquadsV4)({
|
|
161
|
+
provider,
|
|
162
|
+
instructions: [updateIx],
|
|
163
|
+
multisig: argv.multisig ? new web3_js_1.PublicKey(argv.multisig) : undefined,
|
|
164
|
+
signers: [],
|
|
165
|
+
});
|
|
166
|
+
console.log("Council fanout updated.");
|
|
167
|
+
console.log(` mini fanout: ${miniFanout.toBase58()}`);
|
|
168
|
+
if (shares) {
|
|
169
|
+
console.log(` members (${shares.length}):`);
|
|
170
|
+
shares.forEach((s) => console.log(` - ${s.wallet.toBase58()}`));
|
|
171
|
+
}
|
|
172
|
+
if (argv.schedule) {
|
|
173
|
+
console.log(` schedule: ${argv.schedule}`);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=update-council-fanout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-council-fanout.js","sourceRoot":"","sources":["../../src/update-council-fanout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,kBA0GC;AAhJD,0DAA4C;AAC5C,6DAA2D;AAC3D,mDAAwD;AACxD,6CAA4C;AAC5C,4CAAoB;AAC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cAAc,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;YAC7C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -56,26 +56,26 @@ function run() {
|
|
|
56
56
|
return __awaiter(this, arguments, void 0, function* (args = process.argv) {
|
|
57
57
|
const yarg = (0, yargs_1.default)(args).options({
|
|
58
58
|
wallet: {
|
|
59
|
-
alias:
|
|
60
|
-
describe:
|
|
59
|
+
alias: "k",
|
|
60
|
+
describe: "Anchor wallet keypair",
|
|
61
61
|
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
62
62
|
},
|
|
63
63
|
url: {
|
|
64
|
-
alias:
|
|
65
|
-
default:
|
|
66
|
-
describe:
|
|
64
|
+
alias: "u",
|
|
65
|
+
default: "http://127.0.0.1:8899",
|
|
66
|
+
describe: "The solana url",
|
|
67
67
|
},
|
|
68
68
|
dcMint: {
|
|
69
69
|
required: true,
|
|
70
|
-
type:
|
|
71
|
-
describe:
|
|
70
|
+
type: "string",
|
|
71
|
+
describe: "Data credits mint address",
|
|
72
72
|
},
|
|
73
73
|
newAuthority: {
|
|
74
|
-
type:
|
|
74
|
+
type: "string",
|
|
75
75
|
},
|
|
76
76
|
multisig: {
|
|
77
|
-
type:
|
|
78
|
-
describe:
|
|
77
|
+
type: "string",
|
|
78
|
+
describe: "Address of the squads multisig to be authority. If not provided, your wallet will be the authority",
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
const argv = yield yarg.argv;
|
|
@@ -88,7 +88,7 @@ function run() {
|
|
|
88
88
|
const instructions = [];
|
|
89
89
|
const dataCredits = (0, data_credits_sdk_1.dataCreditsKey)(new web3_js_1.PublicKey(argv.dcMint))[0];
|
|
90
90
|
const dataCreditsAcc = yield program.account.dataCreditsV0.fetch(dataCredits);
|
|
91
|
-
console.log(
|
|
91
|
+
console.log("Data Credits", dataCredits.toBase58());
|
|
92
92
|
console.log(dataCreditsAcc.authority.toBase58());
|
|
93
93
|
instructions.push(yield program.methods
|
|
94
94
|
.updateDataCreditsV0({
|
|
@@ -111,6 +111,6 @@ function run() {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
function isNull(vehntDelegated) {
|
|
114
|
-
return vehntDelegated === null || typeof vehntDelegated ==
|
|
114
|
+
return vehntDelegated === null || typeof vehntDelegated == "undefined";
|
|
115
115
|
}
|
|
116
116
|
//# sourceMappingURL=update-data-credits.js.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { init as initMfan } from "@helium/mini-fanout-sdk";
|
|
3
|
+
import { init as initTuktuk } from "@helium/tuktuk-sdk";
|
|
4
|
+
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
|
|
5
|
+
import { PublicKey } from "@solana/web3.js";
|
|
6
|
+
import os from "os";
|
|
7
|
+
import yargs from "yargs/yargs";
|
|
8
|
+
import { resolveTaskRentRefund } from "./mini-fanout-utils";
|
|
9
|
+
import { loadKeypair, sendInstructionsOrSquadsV4 } from "./utils";
|
|
10
|
+
// HIP 149 Decision 4: permanently stop and reclaim the Advisory Council
|
|
11
|
+
// compensation fanout created by create-council-fanout.ts. Closing:
|
|
12
|
+
// - sweeps any HNT still sitting in the fanout's own token account to the
|
|
13
|
+
// owner's HNT ATA (creating it if needed);
|
|
14
|
+
// - dequeues whatever distribution task is currently scheduled;
|
|
15
|
+
// - closes the fanout account itself, refunding its rent to `rent_refund`
|
|
16
|
+
// (the address recorded at creation time — see the fanout's own
|
|
17
|
+
// `rentRefund` field, not necessarily the current owner).
|
|
18
|
+
//
|
|
19
|
+
// This is a one-way operation: there is no "un-close". If the intent is only
|
|
20
|
+
// to change members, the schedule, or pause temporarily, use
|
|
21
|
+
// update-council-fanout.ts instead.
|
|
22
|
+
//
|
|
23
|
+
// The fanout's `owner` (the governance multisig vault) must sign this. Pass
|
|
24
|
+
// `--multisig <governance multisig address>` to route it through Squads V4 as
|
|
25
|
+
// a proposal instead of trying to send it directly.
|
|
26
|
+
//
|
|
27
|
+
// This instruction bakes in the fanout's *current* next_task/next_pre_task
|
|
28
|
+
// (has_one-checked on-chain) at build time, which can go stale while a Squads
|
|
29
|
+
// proposal sits waiting for approval -- the cron can self-reschedule to a new
|
|
30
|
+
// next_task in the meantime. That makes execution fail on-chain (has_one
|
|
31
|
+
// mismatch) rather than corrupt anything, but the proposal is then
|
|
32
|
+
// permanently dead and must be rebuilt. Get proposals approved promptly; if
|
|
33
|
+
// one sits for a while, re-run this script and re-propose.
|
|
34
|
+
export async function run(args = process.argv) {
|
|
35
|
+
const yarg = yargs(args).options({
|
|
36
|
+
wallet: {
|
|
37
|
+
alias: "k",
|
|
38
|
+
describe: "Anchor wallet keypair (payer; proposer if using --multisig)",
|
|
39
|
+
default: `${os.homedir()}/.config/solana/id.json`,
|
|
40
|
+
},
|
|
41
|
+
url: {
|
|
42
|
+
alias: "u",
|
|
43
|
+
default: "http://127.0.0.1:8899",
|
|
44
|
+
describe: "The solana url",
|
|
45
|
+
},
|
|
46
|
+
miniFanout: {
|
|
47
|
+
type: "string",
|
|
48
|
+
required: true,
|
|
49
|
+
describe: "Address of the mini fanout to close",
|
|
50
|
+
},
|
|
51
|
+
multisig: {
|
|
52
|
+
type: "string",
|
|
53
|
+
describe: "Address of the squads multisig to propose through. Required in practice, since the fanout owner is the governance multisig and must sign this.",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const argv = await yarg.argv;
|
|
57
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
58
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
59
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
60
|
+
const provider = anchor.getProvider();
|
|
61
|
+
const wallet = new anchor.Wallet(loadKeypair(argv.wallet));
|
|
62
|
+
const program = await initMfan(provider);
|
|
63
|
+
const tuktukProgram = await initTuktuk(provider);
|
|
64
|
+
const miniFanout = new PublicKey(argv.miniFanout);
|
|
65
|
+
const miniFanoutAcc = await program.account.miniFanoutV0.fetch(miniFanout);
|
|
66
|
+
const taskRentRefund = await resolveTaskRentRefund(tuktukProgram, miniFanoutAcc.nextTask, miniFanout, program.programId, wallet.publicKey);
|
|
67
|
+
const ownerTokenAccount = getAssociatedTokenAddressSync(miniFanoutAcc.mint, miniFanoutAcc.owner, true);
|
|
68
|
+
const closeIx = await program.methods
|
|
69
|
+
.closeMiniFanoutV0()
|
|
70
|
+
.accountsPartial({
|
|
71
|
+
owner: miniFanoutAcc.owner,
|
|
72
|
+
miniFanout,
|
|
73
|
+
mint: miniFanoutAcc.mint,
|
|
74
|
+
rentRefund: miniFanoutAcc.rentRefund,
|
|
75
|
+
taskQueue: miniFanoutAcc.taskQueue,
|
|
76
|
+
tokenAccount: miniFanoutAcc.tokenAccount,
|
|
77
|
+
ownerTokenAccount,
|
|
78
|
+
taskRentRefund,
|
|
79
|
+
})
|
|
80
|
+
.instruction();
|
|
81
|
+
await sendInstructionsOrSquadsV4({
|
|
82
|
+
provider,
|
|
83
|
+
instructions: [closeIx],
|
|
84
|
+
multisig: argv.multisig ? new PublicKey(argv.multisig) : undefined,
|
|
85
|
+
signers: [],
|
|
86
|
+
});
|
|
87
|
+
console.log("Council fanout closed.");
|
|
88
|
+
console.log(` mini fanout: ${miniFanout.toBase58()}`);
|
|
89
|
+
console.log(` HNT swept to: ${ownerTokenAccount.toBase58()}`);
|
|
90
|
+
console.log(` rent refunded: ${miniFanoutAcc.rentRefund.toBase58()}`);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=close-council-fanout.js.map
|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