@helium/helium-admin-cli 0.10.4 → 0.10.6
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/get-merkle-depths.js +114 -0
- package/lib/cjs/get-merkle-depths.js.map +1 -0
- package/lib/cjs/update-destinations.js +209 -0
- package/lib/cjs/update-destinations.js.map +1 -0
- package/lib/esm/src/get-merkle-depths.js +73 -0
- package/lib/esm/src/get-merkle-depths.js.map +1 -0
- package/lib/esm/src/update-destinations.js +161 -0
- package/lib/esm/src/update-destinations.js.map +1 -0
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/get-merkle-depths.d.ts +2 -0
- package/lib/types/src/get-merkle-depths.d.ts.map +1 -0
- package/lib/types/src/update-destinations.d.ts +5 -0
- package/lib/types/src/update-destinations.d.ts.map +1 -0
- package/package.json +13 -13
|
@@ -0,0 +1,114 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.run = void 0;
|
|
39
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
40
|
+
const helium_entity_manager_sdk_1 = require("@helium/helium-entity-manager-sdk");
|
|
41
|
+
const mobile_entity_manager_sdk_1 = require("@helium/mobile-entity-manager-sdk");
|
|
42
|
+
const spl_account_compression_1 = require("@solana/spl-account-compression");
|
|
43
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
44
|
+
const os_1 = __importDefault(require("os"));
|
|
45
|
+
function run(args = process.argv) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const yarg = (0, yargs_1.default)(args).options({
|
|
48
|
+
wallet: {
|
|
49
|
+
alias: "k",
|
|
50
|
+
describe: "Anchor wallet keypair",
|
|
51
|
+
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
52
|
+
},
|
|
53
|
+
url: {
|
|
54
|
+
alias: "u",
|
|
55
|
+
default: "http://127.0.0.1:8899",
|
|
56
|
+
describe: "The solana url",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const argv = yield yarg.argv;
|
|
60
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
61
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
62
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
63
|
+
const provider = anchor.getProvider();
|
|
64
|
+
const hemProgram = yield (0, helium_entity_manager_sdk_1.init)(provider);
|
|
65
|
+
const memProgram = yield (0, mobile_entity_manager_sdk_1.init)(provider);
|
|
66
|
+
// Get all MakerV0 accounts
|
|
67
|
+
const makers = yield hemProgram.account.makerV0.all();
|
|
68
|
+
// Get all carriers
|
|
69
|
+
const carriers = yield memProgram.account.carrierV0.all();
|
|
70
|
+
// Get data only config accounts
|
|
71
|
+
const dataOnlyConfigs = yield hemProgram.account.dataOnlyConfigV0.all();
|
|
72
|
+
const merkleDepths = {};
|
|
73
|
+
// Function to calculate merkle tree depth
|
|
74
|
+
const getMerkleTreeDepth = (account) => {
|
|
75
|
+
let offset = 0;
|
|
76
|
+
const buffer = account.data;
|
|
77
|
+
const [versionedHeader, offsetIncr] = spl_account_compression_1.concurrentMerkleTreeHeaderBeet.deserialize(buffer);
|
|
78
|
+
offset = offsetIncr;
|
|
79
|
+
// Only 1 version available
|
|
80
|
+
if (versionedHeader.header.__kind !== "V1") {
|
|
81
|
+
throw Error(`Header has unsupported version: ${versionedHeader.header.__kind}`);
|
|
82
|
+
}
|
|
83
|
+
const header = versionedHeader.header.fields[0];
|
|
84
|
+
const [_, offsetIncr2] = (0, spl_account_compression_1.concurrentMerkleTreeBeetFactory)(header.maxDepth, header.maxBufferSize).deserialize(buffer, offset);
|
|
85
|
+
offset = offsetIncr2;
|
|
86
|
+
return (0, spl_account_compression_1.getCanopyDepth)(buffer.byteLength - offset);
|
|
87
|
+
};
|
|
88
|
+
// Get depths for all maker merkle trees
|
|
89
|
+
for (const maker of makers) {
|
|
90
|
+
const merkleAccount = yield provider.connection.getAccountInfo(maker.account.merkleTree);
|
|
91
|
+
if (merkleAccount) {
|
|
92
|
+
merkleDepths[maker.account.merkleTree.toBase58()] = getMerkleTreeDepth(merkleAccount);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Get depths for all carrier merkle trees
|
|
96
|
+
for (const carrier of carriers) {
|
|
97
|
+
const merkleAccount = yield provider.connection.getAccountInfo(carrier.account.merkleTree);
|
|
98
|
+
if (merkleAccount) {
|
|
99
|
+
merkleDepths[carrier.account.merkleTree.toBase58()] = getMerkleTreeDepth(merkleAccount);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Get depths for all data only config merkle trees
|
|
103
|
+
for (const config of dataOnlyConfigs) {
|
|
104
|
+
const merkleAccount = yield provider.connection.getAccountInfo(config.account.merkleTree);
|
|
105
|
+
if (merkleAccount) {
|
|
106
|
+
merkleDepths[config.account.merkleTree.toBase58()] = getMerkleTreeDepth(merkleAccount);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Output results as JSON
|
|
110
|
+
console.log(JSON.stringify(merkleDepths, null, 2));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
exports.run = run;
|
|
114
|
+
//# sourceMappingURL=get-merkle-depths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-merkle-depths.js","sourceRoot":"","sources":["../../src/get-merkle-depths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAG5C,iFAE2C;AAC3C,iFAE2C;AAC3C,6EAAsK;AAEtK,kDAA0B;AAC1B,4CAAoB;AAGpB,SAAsB,GAAG,CAAC,OAAY,OAAO,CAAC,IAAI;;QAChD,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAI,CAA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AAU,CAAC,QAAQ,EAAE,CAAC,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;aACzF;SACF;QAED,mDAAmD;QACnD,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;YACpC,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC1F,IAAI,aAAa,EAAE;gBACjB,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;aACxF;SACF;QAED,yBAAyB;QACzB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;CAAA;AApFD,kBAoFC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
35
|
+
var t = {};
|
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
+
t[p] = s[p];
|
|
38
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
+
t[p[i]] = s[p[i]];
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.run = exports.exists = void 0;
|
|
50
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
51
|
+
const lazy_distributor_sdk_1 = require("@helium/lazy-distributor-sdk");
|
|
52
|
+
const spl_utils_1 = require("@helium/spl-utils");
|
|
53
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
54
|
+
const os_1 = __importDefault(require("os"));
|
|
55
|
+
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
56
|
+
function exists(provider, account) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return Boolean(yield provider.connection.getAccountInfo(account));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.exists = exists;
|
|
62
|
+
function getCompressedCollectablesByOwner(provider, pubKey, page, limit) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const endpoint = provider.connection.rpcEndpoint;
|
|
65
|
+
const _a = yield (0, spl_utils_1.searchAssetsWithPageInfo)(endpoint, {
|
|
66
|
+
ownerAddress: pubKey.toBase58(),
|
|
67
|
+
page,
|
|
68
|
+
limit,
|
|
69
|
+
burnt: false,
|
|
70
|
+
options: {
|
|
71
|
+
showGrandTotal: true,
|
|
72
|
+
},
|
|
73
|
+
}), { items } = _a, rest = __rest(_a, ["items"]);
|
|
74
|
+
return Object.assign(Object.assign({}, rest), { items });
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function run(args = process.argv) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const yarg = (0, yargs_1.default)(args).options({
|
|
80
|
+
wallet: {
|
|
81
|
+
alias: "k",
|
|
82
|
+
describe: "Anchor wallet keypair",
|
|
83
|
+
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
84
|
+
},
|
|
85
|
+
url: {
|
|
86
|
+
alias: "u",
|
|
87
|
+
default: "http://127.0.0.1:8899",
|
|
88
|
+
describe: "The solana url",
|
|
89
|
+
},
|
|
90
|
+
mint: {
|
|
91
|
+
type: "string",
|
|
92
|
+
describe: "Token mint type to update recipients for",
|
|
93
|
+
default: "all",
|
|
94
|
+
choices: ["iot", "mobile", "hnt", "all"],
|
|
95
|
+
},
|
|
96
|
+
destination: {
|
|
97
|
+
type: "string",
|
|
98
|
+
describe: "Destination address to update recipients to",
|
|
99
|
+
required: false,
|
|
100
|
+
},
|
|
101
|
+
commit: {
|
|
102
|
+
type: "boolean",
|
|
103
|
+
describe: "Commit transactions to the chain",
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
const PAGE_LIMIT = 1000;
|
|
108
|
+
const argv = yield yarg.argv;
|
|
109
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
110
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
111
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
112
|
+
const provider = anchor.getProvider();
|
|
113
|
+
const lazyProgram = yield (0, lazy_distributor_sdk_1.init)(provider);
|
|
114
|
+
const ownerWallet = provider.publicKey;
|
|
115
|
+
const destination = argv.destination
|
|
116
|
+
? new web3_js_1.PublicKey(argv.destination)
|
|
117
|
+
: web3_js_1.PublicKey.default;
|
|
118
|
+
const destinationExists = yield exists(provider, destination);
|
|
119
|
+
if (!destinationExists) {
|
|
120
|
+
console.log("Destination doesn't exist");
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
console.log(`Searching for hotspots owned by: ${ownerWallet.toBase58()}`);
|
|
124
|
+
console.log(`Destination address: ${destination.toBase58()}`);
|
|
125
|
+
let firstPageResult = yield getCompressedCollectablesByOwner(provider, ownerWallet, 1, PAGE_LIMIT);
|
|
126
|
+
let totalPages = Math.ceil(firstPageResult.total / PAGE_LIMIT);
|
|
127
|
+
let assets = [...firstPageResult.items];
|
|
128
|
+
if (assets.length === 0) {
|
|
129
|
+
console.log("No hotspots found for this wallet");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (totalPages > 1) {
|
|
133
|
+
const remainingPages = Array.from({ length: totalPages - 1 }, (_, i) => i + 2);
|
|
134
|
+
const pageResults = yield Promise.all(remainingPages.map((page) => getCompressedCollectablesByOwner(provider, ownerWallet, page, PAGE_LIMIT)));
|
|
135
|
+
pageResults.forEach((result) => {
|
|
136
|
+
assets = assets.concat(result.items);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const mintMap = {
|
|
140
|
+
iot: spl_utils_1.IOT_MINT,
|
|
141
|
+
mobile: spl_utils_1.MOBILE_MINT,
|
|
142
|
+
hnt: spl_utils_1.HNT_MINT,
|
|
143
|
+
};
|
|
144
|
+
const mintsToUpdate = argv.mint === "all"
|
|
145
|
+
? Object.values(mintMap)
|
|
146
|
+
: [mintMap[argv.mint]];
|
|
147
|
+
const recipientsToUpdate = {};
|
|
148
|
+
mintsToUpdate.forEach((mint) => {
|
|
149
|
+
const mintName = mint.equals(spl_utils_1.IOT_MINT)
|
|
150
|
+
? "iot"
|
|
151
|
+
: mint.equals(spl_utils_1.MOBILE_MINT)
|
|
152
|
+
? "mobile"
|
|
153
|
+
: "hnt";
|
|
154
|
+
recipientsToUpdate[mintName] = [];
|
|
155
|
+
});
|
|
156
|
+
const recipientChecks = assets
|
|
157
|
+
.flatMap((asset) => mintsToUpdate.map((mint) => ({
|
|
158
|
+
mint,
|
|
159
|
+
assetId: asset.id,
|
|
160
|
+
lazyKey: (0, lazy_distributor_sdk_1.lazyDistributorKey)(mint)[0],
|
|
161
|
+
mintName: mint.equals(spl_utils_1.IOT_MINT)
|
|
162
|
+
? "iot"
|
|
163
|
+
: mint.equals(spl_utils_1.MOBILE_MINT)
|
|
164
|
+
? "mobile"
|
|
165
|
+
: "hnt",
|
|
166
|
+
})))
|
|
167
|
+
.map(({ assetId, lazyKey, mintName }) => __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const recipient = (0, lazy_distributor_sdk_1.recipientKey)(lazyKey, assetId)[0];
|
|
169
|
+
const acc = yield lazyProgram.account.recipientV0.fetchNullable(recipient);
|
|
170
|
+
if (acc && acc.destination.toBase58() !== destination.toBase58()) {
|
|
171
|
+
recipientsToUpdate[mintName].push({ recipient, asset: assetId });
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
yield Promise.all(recipientChecks);
|
|
175
|
+
console.log("\nSummary:");
|
|
176
|
+
for (const [mintName, recipients] of Object.entries(recipientsToUpdate)) {
|
|
177
|
+
console.log(`- ${mintName.toUpperCase()}: ${recipients.length} recipients to destination ${destination.toBase58()}`);
|
|
178
|
+
}
|
|
179
|
+
if (argv.commit) {
|
|
180
|
+
try {
|
|
181
|
+
const instructions = yield Promise.all(Object.values(recipientsToUpdate)
|
|
182
|
+
.flat()
|
|
183
|
+
.map(({ recipient, asset }) => __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
const { asset: { ownership: { owner }, }, args, accounts, remainingAccounts, } = yield (0, spl_utils_1.proofArgsAndAccounts)({
|
|
185
|
+
connection: provider.connection,
|
|
186
|
+
assetId: asset,
|
|
187
|
+
});
|
|
188
|
+
return lazyProgram.methods
|
|
189
|
+
.updateCompressionDestinationV0(Object.assign({}, args))
|
|
190
|
+
.accountsPartial(Object.assign(Object.assign({}, accounts), { owner,
|
|
191
|
+
recipient, destination: destination == null ? web3_js_1.PublicKey.default : destination }))
|
|
192
|
+
.remainingAccounts(remainingAccounts)
|
|
193
|
+
.instruction();
|
|
194
|
+
})));
|
|
195
|
+
const transactions = yield (0, spl_utils_1.batchInstructionsToTxsWithPriorityFee)(provider, instructions, { useFirstEstimateForAll: true });
|
|
196
|
+
yield (0, spl_utils_1.bulkSendTransactions)(provider, transactions, console.log, 10, [], 100);
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
console.log("Failed to update recipients", e);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
console.log("\nDry run completed. Use --commit flag to execute the updates.");
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
exports.run = run;
|
|
209
|
+
//# sourceMappingURL=update-destinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC,CAAC,mBAAS,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,IACvD;yBACD,iBAAiB,CAAC,iBAAiB,CAAC;yBACpC,WAAW,EAAE,CAAC;gBACnB,CAAC,CAAA,CAAC,CACL,CAAC;gBAEF,MAAM,YAAY,GAAG,MAAM,IAAA,iDAAqC,EAC9D,QAAQ,EACR,YAAY,EACZ,EAAE,sBAAsB,EAAE,IAAI,EAAE,CACjC,CAAC;gBAEF,MAAM,IAAA,gCAAoB,EACxB,QAAQ,EACR,YAAY,EACZ,OAAO,CAAC,GAAG,EACX,EAAE,EACF,EAAE,EACF,GAAG,CACJ,CAAC;aACH;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC;gBAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;SACF;aAAM;YACL,OAAO,CAAC,GAAG,CACT,gEAAgE,CACjE,CAAC;SACH;IACH,CAAC;CAAA;AA3MD,kBA2MC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { init as initHem } from "@helium/helium-entity-manager-sdk";
|
|
3
|
+
import { init as initMem } from "@helium/mobile-entity-manager-sdk";
|
|
4
|
+
import { concurrentMerkleTreeBeetFactory, concurrentMerkleTreeHeaderBeet, getCanopyDepth } from "@solana/spl-account-compression";
|
|
5
|
+
import yargs from "yargs";
|
|
6
|
+
import os from "os";
|
|
7
|
+
export async function run(args = process.argv) {
|
|
8
|
+
const yarg = yargs(args).options({
|
|
9
|
+
wallet: {
|
|
10
|
+
alias: "k",
|
|
11
|
+
describe: "Anchor wallet keypair",
|
|
12
|
+
default: `${os.homedir()}/.config/solana/id.json`,
|
|
13
|
+
},
|
|
14
|
+
url: {
|
|
15
|
+
alias: "u",
|
|
16
|
+
default: "http://127.0.0.1:8899",
|
|
17
|
+
describe: "The solana url",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const argv = await yarg.argv;
|
|
21
|
+
process.env.ANCHOR_WALLET = argv.wallet;
|
|
22
|
+
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
23
|
+
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
24
|
+
const provider = anchor.getProvider();
|
|
25
|
+
const hemProgram = await initHem(provider);
|
|
26
|
+
const memProgram = await initMem(provider);
|
|
27
|
+
// Get all MakerV0 accounts
|
|
28
|
+
const makers = await hemProgram.account.makerV0.all();
|
|
29
|
+
// Get all carriers
|
|
30
|
+
const carriers = await memProgram.account.carrierV0.all();
|
|
31
|
+
// Get data only config accounts
|
|
32
|
+
const dataOnlyConfigs = await hemProgram.account.dataOnlyConfigV0.all();
|
|
33
|
+
const merkleDepths = {};
|
|
34
|
+
// Function to calculate merkle tree depth
|
|
35
|
+
const getMerkleTreeDepth = (account) => {
|
|
36
|
+
let offset = 0;
|
|
37
|
+
const buffer = account.data;
|
|
38
|
+
const [versionedHeader, offsetIncr] = concurrentMerkleTreeHeaderBeet.deserialize(buffer);
|
|
39
|
+
offset = offsetIncr;
|
|
40
|
+
// Only 1 version available
|
|
41
|
+
if (versionedHeader.header.__kind !== "V1") {
|
|
42
|
+
throw Error(`Header has unsupported version: ${versionedHeader.header.__kind}`);
|
|
43
|
+
}
|
|
44
|
+
const header = versionedHeader.header.fields[0];
|
|
45
|
+
const [_, offsetIncr2] = concurrentMerkleTreeBeetFactory(header.maxDepth, header.maxBufferSize).deserialize(buffer, offset);
|
|
46
|
+
offset = offsetIncr2;
|
|
47
|
+
return getCanopyDepth(buffer.byteLength - offset);
|
|
48
|
+
};
|
|
49
|
+
// Get depths for all maker merkle trees
|
|
50
|
+
for (const maker of makers) {
|
|
51
|
+
const merkleAccount = await provider.connection.getAccountInfo(maker.account.merkleTree);
|
|
52
|
+
if (merkleAccount) {
|
|
53
|
+
merkleDepths[maker.account.merkleTree.toBase58()] = getMerkleTreeDepth(merkleAccount);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Get depths for all carrier merkle trees
|
|
57
|
+
for (const carrier of carriers) {
|
|
58
|
+
const merkleAccount = await provider.connection.getAccountInfo(carrier.account.merkleTree);
|
|
59
|
+
if (merkleAccount) {
|
|
60
|
+
merkleDepths[carrier.account.merkleTree.toBase58()] = getMerkleTreeDepth(merkleAccount);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Get depths for all data only config merkle trees
|
|
64
|
+
for (const config of dataOnlyConfigs) {
|
|
65
|
+
const merkleAccount = await provider.connection.getAccountInfo(config.account.merkleTree);
|
|
66
|
+
if (merkleAccount) {
|
|
67
|
+
merkleDepths[config.account.merkleTree.toBase58()] = getMerkleTreeDepth(merkleAccount);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Output results as JSON
|
|
71
|
+
console.log(JSON.stringify(merkleDepths, null, 2));
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=get-merkle-depths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-merkle-depths.js","sourceRoot":"","sources":["../../../src/get-merkle-depths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EACL,IAAI,IAAI,OAAO,EAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,IAAI,IAAI,OAAO,EAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,cAAc,EAAsC,MAAM,iCAAiC,CAAC;AAEtK,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAY,OAAO,CAAC,IAAI;IAChD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QAC/B,MAAM,EAAE;YACN,KAAK,EAAE,GAAG;YAC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,MAAM,MAAM,IAAI,eAAe,EAAE;QACpC,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,aAAa,EAAE;YACjB,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;SACxF;KACF;IAED,yBAAyB;IACzB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { lazyDistributorKey, recipientKey, init as initLazy, } from "@helium/lazy-distributor-sdk";
|
|
3
|
+
import { IOT_MINT, MOBILE_MINT, HNT_MINT, searchAssetsWithPageInfo, batchInstructionsToTxsWithPriorityFee, bulkSendTransactions, proofArgsAndAccounts, } from "@helium/spl-utils";
|
|
4
|
+
import { PublicKey } from "@solana/web3.js";
|
|
5
|
+
import os from "os";
|
|
6
|
+
import yargs from "yargs/yargs";
|
|
7
|
+
export async function exists(provider, account) {
|
|
8
|
+
return Boolean(await provider.connection.getAccountInfo(account));
|
|
9
|
+
}
|
|
10
|
+
async function getCompressedCollectablesByOwner(provider, pubKey, page, limit) {
|
|
11
|
+
const endpoint = provider.connection.rpcEndpoint;
|
|
12
|
+
const { items, ...rest } = await searchAssetsWithPageInfo(endpoint, {
|
|
13
|
+
ownerAddress: pubKey.toBase58(),
|
|
14
|
+
page,
|
|
15
|
+
limit,
|
|
16
|
+
burnt: false,
|
|
17
|
+
options: {
|
|
18
|
+
showGrandTotal: true,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
...rest,
|
|
23
|
+
items,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export async function run(args = process.argv) {
|
|
27
|
+
const yarg = yargs(args).options({
|
|
28
|
+
wallet: {
|
|
29
|
+
alias: "k",
|
|
30
|
+
describe: "Anchor wallet keypair",
|
|
31
|
+
default: `${os.homedir()}/.config/solana/id.json`,
|
|
32
|
+
},
|
|
33
|
+
url: {
|
|
34
|
+
alias: "u",
|
|
35
|
+
default: "http://127.0.0.1:8899",
|
|
36
|
+
describe: "The solana url",
|
|
37
|
+
},
|
|
38
|
+
mint: {
|
|
39
|
+
type: "string",
|
|
40
|
+
describe: "Token mint type to update recipients for",
|
|
41
|
+
default: "all",
|
|
42
|
+
choices: ["iot", "mobile", "hnt", "all"],
|
|
43
|
+
},
|
|
44
|
+
destination: {
|
|
45
|
+
type: "string",
|
|
46
|
+
describe: "Destination address to update recipients to",
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
commit: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
describe: "Commit transactions to the chain",
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const PAGE_LIMIT = 1000;
|
|
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 lazyProgram = await initLazy(provider);
|
|
62
|
+
const ownerWallet = provider.publicKey;
|
|
63
|
+
const destination = argv.destination
|
|
64
|
+
? new PublicKey(argv.destination)
|
|
65
|
+
: PublicKey.default;
|
|
66
|
+
const destinationExists = await exists(provider, destination);
|
|
67
|
+
if (!destinationExists) {
|
|
68
|
+
console.log("Destination doesn't exist");
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
console.log(`Searching for hotspots owned by: ${ownerWallet.toBase58()}`);
|
|
72
|
+
console.log(`Destination address: ${destination.toBase58()}`);
|
|
73
|
+
let firstPageResult = await getCompressedCollectablesByOwner(provider, ownerWallet, 1, PAGE_LIMIT);
|
|
74
|
+
let totalPages = Math.ceil(firstPageResult.total / PAGE_LIMIT);
|
|
75
|
+
let assets = [...firstPageResult.items];
|
|
76
|
+
if (assets.length === 0) {
|
|
77
|
+
console.log("No hotspots found for this wallet");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (totalPages > 1) {
|
|
81
|
+
const remainingPages = Array.from({ length: totalPages - 1 }, (_, i) => i + 2);
|
|
82
|
+
const pageResults = await Promise.all(remainingPages.map((page) => getCompressedCollectablesByOwner(provider, ownerWallet, page, PAGE_LIMIT)));
|
|
83
|
+
pageResults.forEach((result) => {
|
|
84
|
+
assets = assets.concat(result.items);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const mintMap = {
|
|
88
|
+
iot: IOT_MINT,
|
|
89
|
+
mobile: MOBILE_MINT,
|
|
90
|
+
hnt: HNT_MINT,
|
|
91
|
+
};
|
|
92
|
+
const mintsToUpdate = argv.mint === "all"
|
|
93
|
+
? Object.values(mintMap)
|
|
94
|
+
: [mintMap[argv.mint]];
|
|
95
|
+
const recipientsToUpdate = {};
|
|
96
|
+
mintsToUpdate.forEach((mint) => {
|
|
97
|
+
const mintName = mint.equals(IOT_MINT)
|
|
98
|
+
? "iot"
|
|
99
|
+
: mint.equals(MOBILE_MINT)
|
|
100
|
+
? "mobile"
|
|
101
|
+
: "hnt";
|
|
102
|
+
recipientsToUpdate[mintName] = [];
|
|
103
|
+
});
|
|
104
|
+
const recipientChecks = assets
|
|
105
|
+
.flatMap((asset) => mintsToUpdate.map((mint) => ({
|
|
106
|
+
mint,
|
|
107
|
+
assetId: asset.id,
|
|
108
|
+
lazyKey: lazyDistributorKey(mint)[0],
|
|
109
|
+
mintName: mint.equals(IOT_MINT)
|
|
110
|
+
? "iot"
|
|
111
|
+
: mint.equals(MOBILE_MINT)
|
|
112
|
+
? "mobile"
|
|
113
|
+
: "hnt",
|
|
114
|
+
})))
|
|
115
|
+
.map(async ({ assetId, lazyKey, mintName }) => {
|
|
116
|
+
const recipient = recipientKey(lazyKey, assetId)[0];
|
|
117
|
+
const acc = await lazyProgram.account.recipientV0.fetchNullable(recipient);
|
|
118
|
+
if (acc && acc.destination.toBase58() !== destination.toBase58()) {
|
|
119
|
+
recipientsToUpdate[mintName].push({ recipient, asset: assetId });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
await Promise.all(recipientChecks);
|
|
123
|
+
console.log("\nSummary:");
|
|
124
|
+
for (const [mintName, recipients] of Object.entries(recipientsToUpdate)) {
|
|
125
|
+
console.log(`- ${mintName.toUpperCase()}: ${recipients.length} recipients to destination ${destination.toBase58()}`);
|
|
126
|
+
}
|
|
127
|
+
if (argv.commit) {
|
|
128
|
+
try {
|
|
129
|
+
const instructions = await Promise.all(Object.values(recipientsToUpdate)
|
|
130
|
+
.flat()
|
|
131
|
+
.map(async ({ recipient, asset }) => {
|
|
132
|
+
const { asset: { ownership: { owner }, }, args, accounts, remainingAccounts, } = await proofArgsAndAccounts({
|
|
133
|
+
connection: provider.connection,
|
|
134
|
+
assetId: asset,
|
|
135
|
+
});
|
|
136
|
+
return lazyProgram.methods
|
|
137
|
+
.updateCompressionDestinationV0({
|
|
138
|
+
...args,
|
|
139
|
+
})
|
|
140
|
+
.accountsPartial({
|
|
141
|
+
...accounts,
|
|
142
|
+
owner,
|
|
143
|
+
recipient,
|
|
144
|
+
destination: destination == null ? PublicKey.default : destination,
|
|
145
|
+
})
|
|
146
|
+
.remainingAccounts(remainingAccounts)
|
|
147
|
+
.instruction();
|
|
148
|
+
}));
|
|
149
|
+
const transactions = await batchInstructionsToTxsWithPriorityFee(provider, instructions, { useFirstEstimateForAll: true });
|
|
150
|
+
await bulkSendTransactions(provider, transactions, console.log, 10, [], 100);
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
console.log("Failed to update recipients", e);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
console.log("\nDry run completed. Use --commit flag to execute the updates.");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=update-destinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-destinations.js","sourceRoot":"","sources":["../../../src/update-destinations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,IAAI,IAAI,QAAQ,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,wBAAwB,EACxB,qCAAqC,EACrC,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,QAA+B,EAC/B,OAAkB;IAElB,OAAO,OAAO,CAAC,MAAM,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,KAAK,UAAU,gCAAgC,CAC7C,QAA+B,EAC/B,MAAiB,EACjB,IAAa,EACb,KAAc;IAEd,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;IACjD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,wBAAwB,CAAC,QAAQ,EAAE;QAClE,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE;QAC/B,IAAI;QACJ,KAAK;QACL,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE;YACP,cAAc,EAAE,IAAI;SACrB;KACF,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,IAAI;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