@helium/helium-admin-cli 0.9.20-next.23 → 0.9.21
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/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/lib/cjs/fix-claimed-epochs.js +0 -91
- package/lib/cjs/fix-claimed-epochs.js.map +0 -1
- package/lib/cjs/unrug-hotspots.js +0 -167
- package/lib/cjs/unrug-hotspots.js.map +0 -1
- package/lib/cjs/update-matching-destinations.js +0 -116
- package/lib/cjs/update-matching-destinations.js.map +0 -1
- package/lib/cjs/update-mathing-destinations.js +0 -103
- package/lib/cjs/update-mathing-destinations.js.map +0 -1
- package/lib/cjs/update-proxy-config.js +0 -128
- package/lib/cjs/update-proxy-config.js.map +0 -1
- package/lib/esm/src/fix-claimed-epochs.js +0 -50
- package/lib/esm/src/fix-claimed-epochs.js.map +0 -1
- package/lib/esm/src/unrug-hotspots.js +0 -126
- package/lib/esm/src/unrug-hotspots.js.map +0 -1
- package/lib/esm/src/update-matching-destinations.js +0 -75
- package/lib/esm/src/update-matching-destinations.js.map +0 -1
- package/lib/esm/src/update-mathing-destinations.js +0 -62
- package/lib/esm/src/update-mathing-destinations.js.map +0 -1
- package/lib/esm/src/update-proxy-config.js +0 -87
- package/lib/esm/src/update-proxy-config.js.map +0 -1
- package/lib/types/src/fix-claimed-epochs.d.ts +0 -2
- package/lib/types/src/fix-claimed-epochs.d.ts.map +0 -1
- package/lib/types/src/unrug-hotspots.d.ts +0 -2
- package/lib/types/src/unrug-hotspots.d.ts.map +0 -1
- package/lib/types/src/update-matching-destinations.d.ts +0 -2
- package/lib/types/src/update-matching-destinations.d.ts.map +0 -1
- package/lib/types/src/update-mathing-destinations.d.ts +0 -2
- package/lib/types/src/update-mathing-destinations.d.ts.map +0 -1
- package/lib/types/src/update-proxy-config.d.ts +0 -2
- package/lib/types/src/update-proxy-config.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"registry": "https://registry.npmjs.org/"
|
|
6
6
|
},
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"version": "0.9.
|
|
8
|
+
"version": "0.9.21",
|
|
9
9
|
"description": "CLI to bootstrap the network",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@coral-xyz/anchor": "^0.28.0",
|
|
42
42
|
"@helium/address": "^4.10.2",
|
|
43
|
-
"@helium/circuit-breaker-sdk": "^0.9.
|
|
43
|
+
"@helium/circuit-breaker-sdk": "^0.9.21",
|
|
44
44
|
"@helium/crypto": "^4.10.2",
|
|
45
|
-
"@helium/data-credits-sdk": "^0.9.
|
|
46
|
-
"@helium/distributor-oracle": "^0.9.
|
|
47
|
-
"@helium/fanout-sdk": "^0.9.
|
|
48
|
-
"@helium/helium-entity-manager-sdk": "^0.9.
|
|
49
|
-
"@helium/helium-sub-daos-sdk": "^0.9.
|
|
50
|
-
"@helium/lazy-distributor-sdk": "^0.9.
|
|
51
|
-
"@helium/mobile-entity-manager-sdk": "^0.9.
|
|
45
|
+
"@helium/data-credits-sdk": "^0.9.21",
|
|
46
|
+
"@helium/distributor-oracle": "^0.9.21",
|
|
47
|
+
"@helium/fanout-sdk": "^0.9.21",
|
|
48
|
+
"@helium/helium-entity-manager-sdk": "^0.9.21",
|
|
49
|
+
"@helium/helium-sub-daos-sdk": "^0.9.21",
|
|
50
|
+
"@helium/lazy-distributor-sdk": "^0.9.21",
|
|
51
|
+
"@helium/mobile-entity-manager-sdk": "^0.9.21",
|
|
52
52
|
"@helium/nft-proxy-sdk": "^0.0.15",
|
|
53
53
|
"@helium/organization-sdk": "^0.0.13",
|
|
54
|
-
"@helium/price-oracle-sdk": "^0.9.
|
|
54
|
+
"@helium/price-oracle-sdk": "^0.9.21",
|
|
55
55
|
"@helium/proposal-sdk": "^0.0.15",
|
|
56
|
-
"@helium/spl-utils": "^0.9.
|
|
57
|
-
"@helium/treasury-management-sdk": "^0.9.
|
|
56
|
+
"@helium/spl-utils": "^0.9.21",
|
|
57
|
+
"@helium/treasury-management-sdk": "^0.9.21",
|
|
58
58
|
"@solana/spl-account-compression": "^0.1.7",
|
|
59
59
|
"@solana/spl-governance": "^0.3.18",
|
|
60
60
|
"@solana/spl-token": "^0.3.8",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"typescript": "^5.2.2"
|
|
74
74
|
},
|
|
75
75
|
"author": "",
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "876dd431fda9b645eb56c1a8083f954c2b99a43f"
|
|
77
77
|
}
|
|
@@ -1,91 +0,0 @@
|
|
|
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_sub_daos_sdk_1 = require("@helium/helium-sub-daos-sdk");
|
|
41
|
-
const spl_utils_1 = require("@helium/spl-utils");
|
|
42
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
43
|
-
const fs_1 = __importDefault(require("fs"));
|
|
44
|
-
const os_1 = __importDefault(require("os"));
|
|
45
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
46
|
-
const utils_1 = require("./utils");
|
|
47
|
-
function run(args = process.argv) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const yarg = (0, yargs_1.default)(args).options({
|
|
50
|
-
wallet: {
|
|
51
|
-
alias: "k",
|
|
52
|
-
describe: "Anchor wallet keypair",
|
|
53
|
-
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
54
|
-
},
|
|
55
|
-
url: {
|
|
56
|
-
alias: "u",
|
|
57
|
-
default: "http://127.0.0.1:8899",
|
|
58
|
-
describe: "The solana url",
|
|
59
|
-
},
|
|
60
|
-
delegatedPositions: {
|
|
61
|
-
type: "string",
|
|
62
|
-
describe: "Path to the delegated positions file",
|
|
63
|
-
default: __dirname + "/delegatedPositions.txt",
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
const argv = yield yarg.argv;
|
|
67
|
-
process.env.ANCHOR_WALLET = argv.wallet;
|
|
68
|
-
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
69
|
-
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
70
|
-
const provider = anchor.getProvider();
|
|
71
|
-
const wallet = new anchor.Wallet((0, utils_1.loadKeypair)(argv.wallet));
|
|
72
|
-
const hsdProgram = yield (0, helium_sub_daos_sdk_1.init)(provider);
|
|
73
|
-
const delegatedPositions = fs_1.default.readFileSync(argv.delegatedPositions, "utf-8")
|
|
74
|
-
.split("\n")
|
|
75
|
-
.filter(line => line.trim() !== ""); // Remove empty lines
|
|
76
|
-
const instructions = [];
|
|
77
|
-
for (const delegatedPosition of delegatedPositions) {
|
|
78
|
-
console.log(delegatedPosition, new web3_js_1.PublicKey(delegatedPosition).toBase58());
|
|
79
|
-
instructions.push(yield hsdProgram.methods
|
|
80
|
-
.tempFixClaimedEpoch()
|
|
81
|
-
.accounts({
|
|
82
|
-
authority: wallet.publicKey,
|
|
83
|
-
delegatedPosition: new web3_js_1.PublicKey(delegatedPosition),
|
|
84
|
-
})
|
|
85
|
-
.instruction());
|
|
86
|
-
}
|
|
87
|
-
yield (0, spl_utils_1.batchParallelInstructionsWithPriorityFee)(provider, instructions, { maxSignatureBatch: 100 });
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
exports.run = run;
|
|
91
|
-
//# sourceMappingURL=fix-claimed-epochs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fix-claimed-epochs.js","sourceRoot":"","sources":["../../src/fix-claimed-epochs.ts"],"names":[],"mappings":";;;;;;;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,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC;aACzE,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,qBAAqB;QAE5D,MAAM,YAAY,GAA6B,EAAE,CAAC;QAClD,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE;YAClD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,mBAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5E,YAAY,CAAC,IAAI,CACf,MAAM,UAAU,CAAC,OAAO;iBACrB,mBAAmB,EAAE;iBACrB,QAAQ,CAAC;gBACR,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,iBAAiB,EAAE,IAAI,mBAAS,CAAC,iBAAiB,CAAC;aACpD,CAAC;iBACD,WAAW,EAAE,CACjB,CAAC;SACH;QACD,MAAM,IAAA,oDAAwC,EAAC,QAAQ,EAAE,YAAY,EAAE,EAAC,iBAAiB,EAAE,GAAG,EAAC,CAAC,CAAC;IACnG,CAAC;CAAA;AA5CD,kBA4CC"}
|
|
@@ -1,167 +0,0 @@
|
|
|
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 helium_sub_daos_sdk_1 = require("@helium/helium-sub-daos-sdk");
|
|
42
|
-
const spl_utils_1 = require("@helium/spl-utils");
|
|
43
|
-
const mpl_bubblegum_1 = require("@metaplex-foundation/mpl-bubblegum");
|
|
44
|
-
const spl_account_compression_1 = require("@solana/spl-account-compression");
|
|
45
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
46
|
-
const bs58_1 = __importDefault(require("bs58"));
|
|
47
|
-
const os_1 = __importDefault(require("os"));
|
|
48
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
49
|
-
const utils_1 = require("./utils");
|
|
50
|
-
function run(args = process.argv) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const yarg = (0, yargs_1.default)(args).options({
|
|
53
|
-
ruggedWallet: {
|
|
54
|
-
describe: "Anchor wallet keypair",
|
|
55
|
-
required: true,
|
|
56
|
-
type: "string",
|
|
57
|
-
},
|
|
58
|
-
recipient: {
|
|
59
|
-
describe: "Recipient of the hotspots",
|
|
60
|
-
type: "string",
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
wallet: {
|
|
64
|
-
alias: "k",
|
|
65
|
-
describe: "Anchor wallet keypair",
|
|
66
|
-
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
67
|
-
},
|
|
68
|
-
url: {
|
|
69
|
-
alias: "u",
|
|
70
|
-
default: "http://127.0.0.1:8899",
|
|
71
|
-
describe: "The solana url",
|
|
72
|
-
},
|
|
73
|
-
hntMint: {
|
|
74
|
-
type: "string",
|
|
75
|
-
describe: "HNT mint of the dao to be updated",
|
|
76
|
-
default: spl_utils_1.HNT_MINT.toBase58(),
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
const argv = yield yarg.argv;
|
|
80
|
-
process.env.ANCHOR_WALLET = argv.wallet;
|
|
81
|
-
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
82
|
-
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
83
|
-
const provider = anchor.getProvider();
|
|
84
|
-
const ruggedWallet = new anchor.Wallet((0, utils_1.loadKeypair)(argv.ruggedWallet));
|
|
85
|
-
const ruggedWalletKeypair = (0, utils_1.loadKeypair)(argv.ruggedWallet);
|
|
86
|
-
const myKeypair = (0, utils_1.loadKeypair)(argv.wallet);
|
|
87
|
-
const cNFTs = yield (0, spl_utils_1.searchAssets)(provider.connection.rpcEndpoint, {
|
|
88
|
-
ownerAddress: ruggedWallet.publicKey.toBase58(),
|
|
89
|
-
limit: 1000,
|
|
90
|
-
creatorVerified: true,
|
|
91
|
-
burnt: false,
|
|
92
|
-
creatorAddress: (0, helium_entity_manager_sdk_1.entityCreatorKey)((0, helium_sub_daos_sdk_1.daoKey)(spl_utils_1.HNT_MINT)[0])[0].toBase58(),
|
|
93
|
-
});
|
|
94
|
-
const drafts = [];
|
|
95
|
-
for (const cNFT of cNFTs) {
|
|
96
|
-
const draft = yield transferCompressedCollectable(provider.connection, provider.wallet.publicKey, cNFT, new web3_js_1.PublicKey(argv.recipient));
|
|
97
|
-
drafts.push(draft);
|
|
98
|
-
}
|
|
99
|
-
for (const draft of drafts) {
|
|
100
|
-
const tx = yield (0, spl_utils_1.toVersionedTx)(yield (0, spl_utils_1.populateMissingDraftInfo)(provider.connection, draft));
|
|
101
|
-
yield tx.sign([ruggedWalletKeypair, myKeypair]);
|
|
102
|
-
yield (0, spl_utils_1.bulkSendRawTransactions)(provider.connection, [Buffer.from(tx.serialize())], console.log);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
exports.run = run;
|
|
107
|
-
function getBubblegumAuthorityPDA(merkleRollPubKey) {
|
|
108
|
-
const [bubblegumAuthorityPDAKey] = web3_js_1.PublicKey.findProgramAddressSync([merkleRollPubKey.toBuffer()], new web3_js_1.PublicKey("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"));
|
|
109
|
-
return bubblegumAuthorityPDAKey;
|
|
110
|
-
}
|
|
111
|
-
function bufferToArray(buffer) {
|
|
112
|
-
const nums = [];
|
|
113
|
-
for (let i = 0; i < buffer.length; i += 1) {
|
|
114
|
-
nums.push(buffer[i]);
|
|
115
|
-
}
|
|
116
|
-
return nums;
|
|
117
|
-
}
|
|
118
|
-
const mapProof = (assetProof) => {
|
|
119
|
-
if (!assetProof.proof || assetProof.proof.length === 0) {
|
|
120
|
-
throw new Error("Proof is empty");
|
|
121
|
-
}
|
|
122
|
-
return assetProof.proof.map((node) => ({
|
|
123
|
-
pubkey: new web3_js_1.PublicKey(node),
|
|
124
|
-
isSigner: false,
|
|
125
|
-
isWritable: false,
|
|
126
|
-
}));
|
|
127
|
-
};
|
|
128
|
-
const transferCompressedCollectable = (conn, payer, collectable, recipientPubKey) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
-
const instructions = [];
|
|
130
|
-
const assetProof = (yield (0, spl_utils_1.getAssetProof)(conn.rpcEndpoint, collectable.id));
|
|
131
|
-
const treeAuthority = getBubblegumAuthorityPDA(new web3_js_1.PublicKey(assetProof.treeId));
|
|
132
|
-
const leafDelegate = collectable.ownership.delegate
|
|
133
|
-
? new web3_js_1.PublicKey(collectable.ownership.delegate)
|
|
134
|
-
: new web3_js_1.PublicKey(collectable.ownership.owner);
|
|
135
|
-
const merkleTree = new web3_js_1.PublicKey(assetProof.treeId);
|
|
136
|
-
const tree = yield spl_account_compression_1.ConcurrentMerkleTreeAccount.fromAccountAddress(conn, merkleTree, "confirmed");
|
|
137
|
-
const canopyHeight = tree.getCanopyDepth();
|
|
138
|
-
const proofPath = mapProof(assetProof);
|
|
139
|
-
const anchorRemainingAccounts = proofPath.slice(0, proofPath.length - (canopyHeight || 0));
|
|
140
|
-
const ix = (0, mpl_bubblegum_1.createTransferInstruction)({
|
|
141
|
-
treeAuthority,
|
|
142
|
-
leafOwner: new web3_js_1.PublicKey(collectable.ownership.owner),
|
|
143
|
-
leafDelegate,
|
|
144
|
-
newLeafOwner: recipientPubKey,
|
|
145
|
-
merkleTree,
|
|
146
|
-
logWrapper: spl_account_compression_1.SPL_NOOP_PROGRAM_ID,
|
|
147
|
-
compressionProgram: spl_account_compression_1.SPL_ACCOUNT_COMPRESSION_PROGRAM_ID,
|
|
148
|
-
anchorRemainingAccounts,
|
|
149
|
-
}, {
|
|
150
|
-
root: bufferToArray(assetProof.root.toBuffer()),
|
|
151
|
-
dataHash: bufferToArray(Buffer.from(bs58_1.default.decode(collectable.compression.data_hash.trim()))),
|
|
152
|
-
creatorHash: bufferToArray(Buffer.from(bs58_1.default.decode(collectable.compression.creator_hash.trim()))),
|
|
153
|
-
nonce: collectable.compression.leaf_id,
|
|
154
|
-
index: collectable.compression.leaf_id,
|
|
155
|
-
});
|
|
156
|
-
ix.keys[1].isSigner = true;
|
|
157
|
-
instructions.push(ix);
|
|
158
|
-
return {
|
|
159
|
-
instructions: yield (0, spl_utils_1.withPriorityFees)({
|
|
160
|
-
connection: conn,
|
|
161
|
-
instructions,
|
|
162
|
-
feePayer: payer,
|
|
163
|
-
}),
|
|
164
|
-
feePayer: payer,
|
|
165
|
-
};
|
|
166
|
-
});
|
|
167
|
-
//# sourceMappingURL=unrug-hotspots.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unrug-hotspots.js","sourceRoot":"","sources":["../../src/unrug-hotspots.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,iFAAqE;AACrE,qEAAqD;AACrD,iDAW2B;AAC3B,sEAA+E;AAC/E,6EAIyC;AACzC,6CAKyB;AACzB,gDAAwB;AACxB,4CAAoB;AACpB,wDAAgC;AAChC,mCAAsC;AAEtC,SAAsB,GAAG,CAAC,OAAY,OAAO,CAAC,IAAI;;QAChD,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YAC/B,YAAY,EAAE;gBACZ,QAAQ,EAAE,uBAAuB;gBACjC,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,QAAQ;aACf;YACD,SAAS,EAAE;gBACT,QAAQ,EAAE,2BAA2B;gBACrC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,GAAG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AE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC,CAAA,CAAC"}
|
|
@@ -1,116 +0,0 @@
|
|
|
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 lazy_distributor_sdk_1 = require("@helium/lazy-distributor-sdk");
|
|
41
|
-
const spl_utils_1 = require("@helium/spl-utils");
|
|
42
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
43
|
-
const os_1 = __importDefault(require("os"));
|
|
44
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
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
|
-
name: {
|
|
59
|
-
default: "nJWGUMOK",
|
|
60
|
-
describe: "The lazy transactions instance name",
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
const argv = yield yarg.argv;
|
|
64
|
-
process.env.ANCHOR_WALLET = argv.wallet;
|
|
65
|
-
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
66
|
-
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
67
|
-
const provider = anchor.getProvider();
|
|
68
|
-
const lazyProgram = yield (0, lazy_distributor_sdk_1.init)(provider);
|
|
69
|
-
const recipients = yield lazyProgram.account.recipientV0.all();
|
|
70
|
-
const LD_IOT = new web3_js_1.PublicKey("37eiz5KzYwpAdLgrSh8GT1isKiJ6hcE5ET86dqaoCugL");
|
|
71
|
-
const LD_MOBILE = new web3_js_1.PublicKey("GZtTp3AUo2AHdQe9BCJ6gXR9KqfruRvHnZ4QiJUALMcz");
|
|
72
|
-
const LD_HNT = new web3_js_1.PublicKey("6gcZXjHgKUBMedc2V1aZLFPwh8M1rPVRw7kpo2KqNrFq");
|
|
73
|
-
const needUpdate = recipients.filter((r) => !r.account.destination.equals(web3_js_1.PublicKey.default) &&
|
|
74
|
-
(r.account.lazyDistributor.equals(LD_IOT) ||
|
|
75
|
-
r.account.lazyDistributor.equals(LD_MOBILE)));
|
|
76
|
-
const hntRecipientsByKey = recipients
|
|
77
|
-
.filter((r) => r.account.lazyDistributor.equals(LD_HNT))
|
|
78
|
-
.reduce((acc, r) => {
|
|
79
|
-
acc[r.account.destination.toString()] = r;
|
|
80
|
-
return acc;
|
|
81
|
-
}, {});
|
|
82
|
-
const instructions = [];
|
|
83
|
-
for (const r of needUpdate) {
|
|
84
|
-
const asset = r.account.asset;
|
|
85
|
-
const assetOnChain = yield provider.connection.getAccountInfo(asset);
|
|
86
|
-
// Only doing this to cNFTs
|
|
87
|
-
if (!assetOnChain) {
|
|
88
|
-
const hntRecipient = hntRecipientsByKey[r.account.destination.toString()];
|
|
89
|
-
if (!hntRecipient || (hntRecipient === null || hntRecipient === void 0 ? void 0 : hntRecipient.account.destination.equals(web3_js_1.PublicKey.default))) {
|
|
90
|
-
let hntRecipientKey = hntRecipient === null || hntRecipient === void 0 ? void 0 : hntRecipient.publicKey;
|
|
91
|
-
if (!hntRecipient) {
|
|
92
|
-
const { instruction, pubkeys } = yield (yield (0, lazy_distributor_sdk_1.initializeCompressionRecipient)({
|
|
93
|
-
program: lazyProgram,
|
|
94
|
-
assetId: asset,
|
|
95
|
-
lazyDistributor: LD_HNT,
|
|
96
|
-
payer: provider.wallet.publicKey,
|
|
97
|
-
})).prepare();
|
|
98
|
-
hntRecipientKey = pubkeys.recipient;
|
|
99
|
-
instructions.push(instruction);
|
|
100
|
-
}
|
|
101
|
-
instructions.push(yield lazyProgram.methods
|
|
102
|
-
.tempUpdateMatchingDestination()
|
|
103
|
-
.accountsStrict({
|
|
104
|
-
recipient: hntRecipientKey,
|
|
105
|
-
authority: provider.wallet.publicKey,
|
|
106
|
-
originalRecipient: r.publicKey,
|
|
107
|
-
})
|
|
108
|
-
.instruction());
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
yield (0, spl_utils_1.batchParallelInstructionsWithPriorityFee)(provider, instructions);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
exports.run = run;
|
|
116
|
-
//# sourceMappingURL=update-matching-destinations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-matching-destinations.js","sourceRoot":"","sources":["../../src/update-matching-destinations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,uEAGsC;AACtC,iDAA6E;AAC7E,6CAAoE;AACpE,4CAAoB;AACpB,wDAAgC;AAEhC,SAAsB,GAAG,CAAC,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,IAAI,EAAE;gBACJ,OAAO,EAAE,UAAU;gBACnB,QAAQ,EAAE,qCAAqC;aAChD;SACF,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MA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E,QAAQ,CAAC,MAAM,CAAC,SAAS;wBACpC,iBAAiB,EAAE,CAAC,CAAC,SAAS;qBAC/B,CAAC;yBACD,WAAW,EAAE,CACjB,CAAC;iBACH;aACF;SACF;QAED,MAAM,IAAA,oDAAwC,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzE,CAAC;CAAA;AAjFD,kBAiFC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
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 lazy_distributor_sdk_1 = require("@helium/lazy-distributor-sdk");
|
|
41
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
42
|
-
const os_1 = __importDefault(require("os"));
|
|
43
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
44
|
-
function run(args = process.argv) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const yarg = (0, yargs_1.default)(args).options({
|
|
47
|
-
wallet: {
|
|
48
|
-
alias: "k",
|
|
49
|
-
describe: "Anchor wallet keypair",
|
|
50
|
-
default: `${os_1.default.homedir()}/.config/solana/id.json`,
|
|
51
|
-
},
|
|
52
|
-
url: {
|
|
53
|
-
alias: "u",
|
|
54
|
-
default: "http://127.0.0.1:8899",
|
|
55
|
-
describe: "The solana url",
|
|
56
|
-
},
|
|
57
|
-
name: {
|
|
58
|
-
default: "nJWGUMOK",
|
|
59
|
-
describe: "The lazy transactions instance name",
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
const argv = yield yarg.argv;
|
|
63
|
-
process.env.ANCHOR_WALLET = argv.wallet;
|
|
64
|
-
process.env.ANCHOR_PROVIDER_URL = argv.url;
|
|
65
|
-
anchor.setProvider(anchor.AnchorProvider.local(argv.url));
|
|
66
|
-
const provider = anchor.getProvider();
|
|
67
|
-
const lazyProgram = yield (0, lazy_distributor_sdk_1.init)(provider);
|
|
68
|
-
const recipients = yield lazyProgram.account.recipientV0.all();
|
|
69
|
-
const LD_IOT = new web3_js_1.PublicKey("37eiz5KzYwpAdLgrSh8GT1isKiJ6hcE5ET86dqaoCugL");
|
|
70
|
-
const LD_MOBILE = new web3_js_1.PublicKey("GZtTp3AUo2AHdQe9BCJ6gXR9KqfruRvHnZ4QiJUALMcz");
|
|
71
|
-
const LD_HNT = new web3_js_1.PublicKey("6gcZXjHgKUBMedc2V1aZLFPwh8M1rPVRw7kpo2KqNrFq");
|
|
72
|
-
const needUpdate = recipients.filter((r) => !r.account.destination.equals(web3_js_1.PublicKey.default) &&
|
|
73
|
-
(r.account.lazyDistributor.equals(LD_IOT) ||
|
|
74
|
-
r.account.lazyDistributor.equals(LD_MOBILE)));
|
|
75
|
-
const hntRecipientsByKey = recipients
|
|
76
|
-
.filter((r) => r.account.lazyDistributor.equals(LD_HNT))
|
|
77
|
-
.reduce((acc, r) => {
|
|
78
|
-
acc[r.account.destination.toString()] = r;
|
|
79
|
-
return acc;
|
|
80
|
-
}, {});
|
|
81
|
-
const instructions = [];
|
|
82
|
-
for (const r of needUpdate) {
|
|
83
|
-
const asset = r.account.asset;
|
|
84
|
-
const assetOnChain = yield provider.connection.getAccountInfo(asset);
|
|
85
|
-
// Only doing this to cNFTs
|
|
86
|
-
if (!assetOnChain) {
|
|
87
|
-
const hntRecipient = hntRecipientsByKey[r.account.destination.toString()];
|
|
88
|
-
if (!hntRecipient) {
|
|
89
|
-
instructions.push(yield (yield (0, lazy_distributor_sdk_1.initializeCompressionRecipient)({
|
|
90
|
-
program: lazyProgram,
|
|
91
|
-
assetId: asset,
|
|
92
|
-
lazyDistributor: LD_HNT,
|
|
93
|
-
payer: provider.wallet.publicKey,
|
|
94
|
-
})).instruction());
|
|
95
|
-
}
|
|
96
|
-
instructions.push();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
console.log("Done");
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
exports.run = run;
|
|
103
|
-
//# sourceMappingURL=update-mathing-destinations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-mathing-destinations.js","sourceRoot":"","sources":["../../src/update-mathing-destinations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,uEAGsC;AAEtC,6CAKyB;AACzB,4CAAoB;AACpB,wDAAgC;AAEhC,SAAsB,GAAG,CAAC,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,IAAI,EAAE;gBACJ,OAAO,EAAE,UAAU;gBACnB,QAAQ,EAAE,qCAAqC;aAChD;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,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAA2B,CAAC;QAC/D,MAAM,WAAW,GAAG,MAAM,IAAA,2BAAQ,EAAC,QAAQ,CAA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