@helium/helium-admin-cli 0.2.21 → 0.2.22-next.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/lib/cjs/approve-carrier.js +18 -17
  2. package/lib/cjs/approve-carrier.js.map +1 -1
  3. package/lib/cjs/approve-program.js +21 -20
  4. package/lib/cjs/approve-program.js.map +1 -1
  5. package/lib/cjs/close-buffers.js +15 -14
  6. package/lib/cjs/close-buffers.js.map +1 -1
  7. package/lib/cjs/close-canopy.js +21 -17
  8. package/lib/cjs/close-canopy.js.map +1 -1
  9. package/lib/cjs/close-lazy-transaction-markers.js +108 -0
  10. package/lib/cjs/close-lazy-transaction-markers.js.map +1 -0
  11. package/lib/cjs/create-dao.js +72 -71
  12. package/lib/cjs/create-dao.js.map +1 -1
  13. package/lib/cjs/create-data-only-config.js +22 -21
  14. package/lib/cjs/create-data-only-config.js.map +1 -1
  15. package/lib/cjs/create-maker.js +44 -42
  16. package/lib/cjs/create-maker.js.map +1 -1
  17. package/lib/cjs/create-price-oracle.js +28 -22
  18. package/lib/cjs/create-price-oracle.js.map +1 -1
  19. package/lib/cjs/create-subdao.js +96 -92
  20. package/lib/cjs/create-subdao.js.map +1 -1
  21. package/lib/cjs/issue-iot-operations-fund.js +17 -16
  22. package/lib/cjs/issue-iot-operations-fund.js.map +1 -1
  23. package/lib/cjs/repair-iot-operations-fund.js +16 -15
  24. package/lib/cjs/repair-iot-operations-fund.js.map +1 -1
  25. package/lib/cjs/reset-clockwork.js +24 -23
  26. package/lib/cjs/reset-clockwork.js.map +1 -1
  27. package/lib/cjs/reset-vsr-max-voter-record.js +24 -23
  28. package/lib/cjs/reset-vsr-max-voter-record.js.map +1 -1
  29. package/lib/cjs/reset-vsr-voting-mint.js +24 -23
  30. package/lib/cjs/reset-vsr-voting-mint.js.map +1 -1
  31. package/lib/cjs/setup-hst.js +36 -35
  32. package/lib/cjs/setup-hst.js.map +1 -1
  33. package/lib/cjs/update-account-circuit-breaker.js +21 -18
  34. package/lib/cjs/update-account-circuit-breaker.js.map +1 -1
  35. package/lib/cjs/update-aggregator.js +21 -20
  36. package/lib/cjs/update-aggregator.js.map +1 -1
  37. package/lib/cjs/update-dao.js +47 -34
  38. package/lib/cjs/update-dao.js.map +1 -1
  39. package/lib/cjs/update-data-credits.js +19 -18
  40. package/lib/cjs/update-data-credits.js.map +1 -1
  41. package/lib/cjs/update-delegated-dc-subdao.js +18 -17
  42. package/lib/cjs/update-delegated-dc-subdao.js.map +1 -1
  43. package/lib/cjs/update-iot-operations-fund-metadata.js +2 -1
  44. package/lib/cjs/update-iot-operations-fund-metadata.js.map +1 -1
  45. package/lib/cjs/update-lazy-distributor.js +25 -24
  46. package/lib/cjs/update-lazy-distributor.js.map +1 -1
  47. package/lib/cjs/update-lazy-transactions.js +15 -14
  48. package/lib/cjs/update-lazy-transactions.js.map +1 -1
  49. package/lib/cjs/update-mint-circuit-breaker.js +18 -17
  50. package/lib/cjs/update-mint-circuit-breaker.js.map +1 -1
  51. package/lib/cjs/update-registrar-authorities.js +15 -11
  52. package/lib/cjs/update-registrar-authorities.js.map +1 -1
  53. package/lib/cjs/update-rewardable-entity-config.js +25 -24
  54. package/lib/cjs/update-rewardable-entity-config.js.map +1 -1
  55. package/lib/cjs/update-subdao-vehnt.js +35 -34
  56. package/lib/cjs/update-subdao-vehnt.js.map +1 -1
  57. package/lib/cjs/update-subdao.js +56 -46
  58. package/lib/cjs/update-subdao.js.map +1 -1
  59. package/lib/cjs/upgrade-idl.js +18 -17
  60. package/lib/cjs/upgrade-idl.js.map +1 -1
  61. package/lib/esm/src/approve-carrier.js +27 -26
  62. package/lib/esm/src/approve-carrier.js.map +1 -1
  63. package/lib/esm/src/approve-program.js +30 -29
  64. package/lib/esm/src/approve-program.js.map +1 -1
  65. package/lib/esm/src/close-buffers.js +23 -22
  66. package/lib/esm/src/close-buffers.js.map +1 -1
  67. package/lib/esm/src/close-canopy.js +28 -24
  68. package/lib/esm/src/close-canopy.js.map +1 -1
  69. package/lib/esm/src/close-lazy-transaction-markers.js +67 -0
  70. package/lib/esm/src/close-lazy-transaction-markers.js.map +1 -0
  71. package/lib/esm/src/create-dao.js +90 -89
  72. package/lib/esm/src/create-dao.js.map +1 -1
  73. package/lib/esm/src/create-data-only-config.js +34 -33
  74. package/lib/esm/src/create-data-only-config.js.map +1 -1
  75. package/lib/esm/src/create-maker.js +58 -56
  76. package/lib/esm/src/create-maker.js.map +1 -1
  77. package/lib/esm/src/create-price-oracle.js +37 -31
  78. package/lib/esm/src/create-price-oracle.js.map +1 -1
  79. package/lib/esm/src/create-subdao.js +112 -108
  80. package/lib/esm/src/create-subdao.js.map +1 -1
  81. package/lib/esm/src/issue-iot-operations-fund.js +27 -26
  82. package/lib/esm/src/issue-iot-operations-fund.js.map +1 -1
  83. package/lib/esm/src/repair-iot-operations-fund.js +24 -23
  84. package/lib/esm/src/repair-iot-operations-fund.js.map +1 -1
  85. package/lib/esm/src/reset-clockwork.js +31 -30
  86. package/lib/esm/src/reset-clockwork.js.map +1 -1
  87. package/lib/esm/src/reset-vsr-max-voter-record.js +32 -31
  88. package/lib/esm/src/reset-vsr-max-voter-record.js.map +1 -1
  89. package/lib/esm/src/reset-vsr-voting-mint.js +32 -31
  90. package/lib/esm/src/reset-vsr-voting-mint.js.map +1 -1
  91. package/lib/esm/src/setup-hst.js +50 -49
  92. package/lib/esm/src/setup-hst.js.map +1 -1
  93. package/lib/esm/src/update-account-circuit-breaker.js +29 -26
  94. package/lib/esm/src/update-account-circuit-breaker.js.map +1 -1
  95. package/lib/esm/src/update-aggregator.js +28 -27
  96. package/lib/esm/src/update-aggregator.js.map +1 -1
  97. package/lib/esm/src/update-dao.js +55 -42
  98. package/lib/esm/src/update-dao.js.map +1 -1
  99. package/lib/esm/src/update-data-credits.js +26 -25
  100. package/lib/esm/src/update-data-credits.js.map +1 -1
  101. package/lib/esm/src/update-delegated-dc-subdao.js +27 -26
  102. package/lib/esm/src/update-delegated-dc-subdao.js.map +1 -1
  103. package/lib/esm/src/update-iot-operations-fund-metadata.js +3 -2
  104. package/lib/esm/src/update-iot-operations-fund-metadata.js.map +1 -1
  105. package/lib/esm/src/update-lazy-distributor.js +32 -31
  106. package/lib/esm/src/update-lazy-distributor.js.map +1 -1
  107. package/lib/esm/src/update-lazy-transactions.js +22 -21
  108. package/lib/esm/src/update-lazy-transactions.js.map +1 -1
  109. package/lib/esm/src/update-mint-circuit-breaker.js +26 -25
  110. package/lib/esm/src/update-mint-circuit-breaker.js.map +1 -1
  111. package/lib/esm/src/update-registrar-authorities.js +22 -18
  112. package/lib/esm/src/update-registrar-authorities.js.map +1 -1
  113. package/lib/esm/src/update-rewardable-entity-config.js +34 -33
  114. package/lib/esm/src/update-rewardable-entity-config.js.map +1 -1
  115. package/lib/esm/src/update-subdao-vehnt.js +45 -44
  116. package/lib/esm/src/update-subdao-vehnt.js.map +1 -1
  117. package/lib/esm/src/update-subdao.js +67 -57
  118. package/lib/esm/src/update-subdao.js.map +1 -1
  119. package/lib/esm/src/upgrade-idl.js +24 -23
  120. package/lib/esm/src/upgrade-idl.js.map +1 -1
  121. package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
  122. package/lib/types/src/approve-carrier.d.ts.map +1 -1
  123. package/lib/types/src/approve-program.d.ts.map +1 -1
  124. package/lib/types/src/close-buffers.d.ts.map +1 -1
  125. package/lib/types/src/close-canopy.d.ts.map +1 -1
  126. package/lib/types/src/close-lazy-transaction-markers.d.ts +2 -0
  127. package/lib/types/src/close-lazy-transaction-markers.d.ts.map +1 -0
  128. package/lib/types/src/create-dao.d.ts.map +1 -1
  129. package/lib/types/src/create-data-only-config.d.ts.map +1 -1
  130. package/lib/types/src/create-maker.d.ts.map +1 -1
  131. package/lib/types/src/create-price-oracle.d.ts.map +1 -1
  132. package/lib/types/src/create-subdao.d.ts.map +1 -1
  133. package/lib/types/src/issue-iot-operations-fund.d.ts.map +1 -1
  134. package/lib/types/src/repair-iot-operations-fund.d.ts.map +1 -1
  135. package/lib/types/src/reset-clockwork.d.ts.map +1 -1
  136. package/lib/types/src/reset-vsr-max-voter-record.d.ts.map +1 -1
  137. package/lib/types/src/reset-vsr-voting-mint.d.ts.map +1 -1
  138. package/lib/types/src/setup-hst.d.ts +1 -1
  139. package/lib/types/src/setup-hst.d.ts.map +1 -1
  140. package/lib/types/src/update-aggregator.d.ts.map +1 -1
  141. package/lib/types/src/update-dao.d.ts.map +1 -1
  142. package/lib/types/src/update-data-credits.d.ts.map +1 -1
  143. package/lib/types/src/update-delegated-dc-subdao.d.ts.map +1 -1
  144. package/lib/types/src/update-iot-operations-fund-metadata.d.ts.map +1 -1
  145. package/lib/types/src/update-lazy-distributor.d.ts.map +1 -1
  146. package/lib/types/src/update-lazy-transactions.d.ts.map +1 -1
  147. package/lib/types/src/update-mint-circuit-breaker.d.ts.map +1 -1
  148. package/lib/types/src/update-rewardable-entity-config.d.ts.map +1 -1
  149. package/lib/types/src/update-subdao-vehnt.d.ts.map +1 -1
  150. package/lib/types/src/update-subdao.d.ts.map +1 -1
  151. package/lib/types/src/upgrade-idl.d.ts.map +1 -1
  152. package/package.json +25 -25
@@ -1,48 +1,49 @@
1
- import * as anchor from "@coral-xyz/anchor";
2
- import { PublicKey } from "@solana/web3.js";
3
- import Squads from "@sqds/sdk";
4
- import os from "os";
5
- import yargs from "yargs/yargs";
6
- import { createCloseBufferInstruction, sendInstructionsOrSquads } from "./utils";
7
- import { BPF_UPGRADE_LOADER_ID } from "@solana/spl-governance";
8
- import bs58 from "bs58";
1
+ import * as anchor from '@coral-xyz/anchor';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import Squads from '@sqds/sdk';
4
+ import os from 'os';
5
+ import yargs from 'yargs/yargs';
6
+ import { createCloseBufferInstruction, loadKeypair, sendInstructionsOrSquads, } from './utils';
7
+ import { BPF_UPGRADE_LOADER_ID } from '@solana/spl-governance';
8
+ import bs58 from 'bs58';
9
9
  export async function run(args = process.argv) {
10
10
  const yarg = yargs(args).options({
11
11
  wallet: {
12
- alias: "k",
13
- describe: "Anchor wallet keypair",
12
+ alias: 'k',
13
+ describe: 'Anchor wallet keypair',
14
14
  default: `${os.homedir()}/.config/solana/id.json`,
15
15
  },
16
16
  url: {
17
- alias: "u",
18
- default: "http://127.0.0.1:8899",
19
- describe: "The solana url",
17
+ alias: 'u',
18
+ default: 'http://127.0.0.1:8899',
19
+ describe: 'The solana url',
20
20
  },
21
21
  executeTransaction: {
22
- type: "boolean",
22
+ type: 'boolean',
23
23
  },
24
24
  multisig: {
25
- type: "string",
26
- describe: "Address of the squads multisig to be authority. If not provided, your wallet will be the authority",
25
+ type: 'string',
26
+ describe: 'Address of the squads multisig to be authority. If not provided, your wallet will be the authority',
27
27
  },
28
28
  authorityIndex: {
29
- type: "number",
30
- describe: "Authority index for squads. Defaults to 1",
29
+ type: 'number',
30
+ describe: 'Authority index for squads. Defaults to 1',
31
31
  default: 1,
32
32
  },
33
33
  programId: {
34
- type: "string",
34
+ type: 'string',
35
35
  required: true,
36
- }
36
+ },
37
37
  });
38
38
  const argv = await yarg.argv;
39
39
  process.env.ANCHOR_WALLET = argv.wallet;
40
40
  process.env.ANCHOR_PROVIDER_URL = argv.url;
41
41
  anchor.setProvider(anchor.AnchorProvider.local(argv.url));
42
42
  const provider = anchor.getProvider();
43
+ const wallet = new anchor.Wallet(loadKeypair(argv.wallet));
43
44
  const connection = provider.connection;
44
- const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, provider.wallet, {
45
- commitmentOrConfig: "finalized",
45
+ const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, wallet, {
46
+ commitmentOrConfig: 'finalized',
46
47
  });
47
48
  let authority = provider.wallet.publicKey;
48
49
  let multisig = argv.multisig ? new PublicKey(argv.multisig) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"close-buffers.js","sourceRoot":"","sources":["../../../src/close-buffers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM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CAAC;iBACxD;aACF;SACF;KACF,CAAC,CACH,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAChB,4BAA4B,CAC1B,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAC7B,CAAC,EACD,SAAS,EACT,QAAQ,CAAC,MAAM,CAAC,SAAS,CAC1B,CACF,CACF,CAAC;IACF,MAAM,wBAAwB,CAAC;QAC7B,QAAQ;QACR,YAAY;QACZ,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,MAAM;QACN,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QAClE,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,OAAO,EAAE,EAAE;KACZ,CAAC,CAAC;AACL,CAAC"}
@@ -1,37 +1,37 @@
1
- import * as anchor from "@coral-xyz/anchor";
2
- import { PublicKey } from "@solana/web3.js";
3
- import Squads from "@sqds/sdk";
4
- import os from "os";
5
- import yargs from "yargs/yargs";
6
- import { sendInstructionsOrSquads } from "./utils";
7
- import { init, lazyTransactionsKey } from "@helium/lazy-transactions-sdk";
1
+ import * as anchor from '@coral-xyz/anchor';
2
+ import { PublicKey } from '@solana/web3.js';
3
+ import Squads from '@sqds/sdk';
4
+ import os from 'os';
5
+ import yargs from 'yargs/yargs';
6
+ import { loadKeypair, sendInstructionsOrSquads, } from './utils';
7
+ import { init, lazyTransactionsKey } from '@helium/lazy-transactions-sdk';
8
8
  export async function run(args = process.argv) {
9
9
  const yarg = yargs(args).options({
10
10
  wallet: {
11
- alias: "k",
12
- describe: "Anchor wallet keypair",
11
+ alias: 'k',
12
+ describe: 'Anchor wallet keypair',
13
13
  default: `${os.homedir()}/.config/solana/id.json`,
14
14
  },
15
15
  url: {
16
- alias: "u",
17
- default: "http://127.0.0.1:8899",
18
- describe: "The solana url",
16
+ alias: 'u',
17
+ default: 'http://127.0.0.1:8899',
18
+ describe: 'The solana url',
19
19
  },
20
20
  name: {
21
21
  required: true,
22
- type: "string",
23
- describe: "Lazy dist name",
22
+ type: 'string',
23
+ describe: 'Lazy dist name',
24
24
  },
25
25
  executeTransaction: {
26
- type: "boolean",
26
+ type: 'boolean',
27
27
  },
28
28
  multisig: {
29
- type: "string",
30
- describe: "Address of the squads multisig to be authority. If not provided, your wallet will be the authority",
29
+ type: 'string',
30
+ describe: 'Address of the squads multisig to be authority. If not provided, your wallet will be the authority',
31
31
  },
32
32
  authorityIndex: {
33
- type: "number",
34
- describe: "Authority index for squads. Defaults to 1",
33
+ type: 'number',
34
+ describe: 'Authority index for squads. Defaults to 1',
35
35
  default: 1,
36
36
  },
37
37
  });
@@ -40,15 +40,19 @@ export async function run(args = process.argv) {
40
40
  process.env.ANCHOR_PROVIDER_URL = argv.url;
41
41
  anchor.setProvider(anchor.AnchorProvider.local(argv.url));
42
42
  const provider = anchor.getProvider();
43
+ const wallet = new anchor.Wallet(loadKeypair(argv.wallet));
43
44
  const program = await init(provider);
44
45
  const instructions = [];
45
46
  const lazyTransactions = lazyTransactionsKey(argv.name)[0];
46
- instructions.push(await program.methods.closeCanopyV0().accounts({
47
+ instructions.push(await program.methods
48
+ .closeCanopyV0()
49
+ .accounts({
47
50
  lazyTransactions,
48
- refund: provider.wallet.publicKey
49
- }).instruction());
50
- const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, provider.wallet, {
51
- commitmentOrConfig: "finalized",
51
+ refund: provider.wallet.publicKey,
52
+ })
53
+ .instruction());
54
+ const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, wallet, {
55
+ commitmentOrConfig: 'finalized',
52
56
  });
53
57
  await sendInstructionsOrSquads({
54
58
  provider,
@@ -1 +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CAAC,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAA2B,CAAC;IAC/D,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,YAAY,GAA6B,EAAE,CAAC;IAElD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,YAAY,CAAC,IAAI,CACf,MAAM,OAAO,CAAC,OAAO;SAClB,aAAa,EAAE;SACf,QAAQ,CAAC;QACR,gBAAgB;QAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;KAClC,CAAC;SACD,WAAW,EAAE,CACjB,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,EAAE;QACtE,kBAAkB,EAAE,WAAW;KAChC,CAAC,CAAC;IACH,MAAM,wBAAwB,CAAC;QAC7B,QAAQ;QACR,YAAY;QACZ,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,MAAM;QACN,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QAClE,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,OAAO,EAAE,EAAE;KACZ,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,67 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { blockKey, init as initLazy, lazyTransactionsKey } from "@helium/lazy-transactions-sdk";
3
+ import os from "os";
4
+ import yargs from "yargs/yargs";
5
+ import { bulkSendTransactions, chunks } from "@helium/spl-utils";
6
+ import { Transaction } from "@solana/web3.js";
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
+ name: {
20
+ default: "nJWGUMOK",
21
+ describe: "The lazy transactions instance name"
22
+ }
23
+ });
24
+ const argv = await yarg.argv;
25
+ process.env.ANCHOR_WALLET = argv.wallet;
26
+ process.env.ANCHOR_PROVIDER_URL = argv.url;
27
+ anchor.setProvider(anchor.AnchorProvider.local(argv.url));
28
+ const provider = anchor.getProvider();
29
+ const lazyProgram = await initLazy(provider);
30
+ const ltKey = lazyTransactionsKey(argv.name)[0];
31
+ const lt = await lazyProgram.account.lazyTransactionsV0.fetch(ltKey);
32
+ const blocks = await lazyProgram.account.block.all();
33
+ const blocksByKey = new Set(blocks.map((b) => b.publicKey.toString()));
34
+ const allIndices = new Array(1 << lt.maxDepth).fill(0).map((_, i) => i);
35
+ const blockIndices = allIndices.filter((bi) => blocksByKey.has(blockKey(ltKey, bi)[0].toBase58()));
36
+ if (lt.executed.length !== 1 << lt.maxDepth) {
37
+ await lazyProgram.methods
38
+ .reinitializeExecutedTransactionsV0()
39
+ .accounts({
40
+ lazyTransactions: ltKey,
41
+ })
42
+ .rpc({ skipPreflight: true });
43
+ }
44
+ const instructions = await Promise.all(blockIndices.map((bi) => lazyProgram.methods
45
+ .closeMarkerV0({
46
+ index: bi,
47
+ })
48
+ .accounts({
49
+ refund: provider.wallet.publicKey,
50
+ lazyTransactions: ltKey,
51
+ authority: provider.wallet.publicKey,
52
+ })
53
+ .instruction()));
54
+ console.log(`${blocks.length} blocks to close`);
55
+ const txns = chunks(instructions, 10).map(chunk => {
56
+ const tx = new Transaction({
57
+ feePayer: provider.wallet.publicKey,
58
+ });
59
+ tx.add(...chunk);
60
+ return tx;
61
+ });
62
+ await bulkSendTransactions(provider, txns, (status) => {
63
+ console.log(`Sending ${status.currentBatchProgress} / ${status.currentBatchSize} batch. ${status.totalProgress} / ${txns.length}`);
64
+ });
65
+ console.log("Done");
66
+ }
67
+ //# sourceMappingURL=close-lazy-transaction-markers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close-lazy-transaction-markers.js","sourceRoot":"","sources":["../../../src/close-lazy-transaction-markers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,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;YACV,QAAQ,EAAE,uBAAuB;YACjC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,yBAAyB;SAClD;QACD,GAAG,EAAE;YACH,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,uBAAuB;YAChC,QAAQ,EAAE,gBAAgB;SAC3B;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,UAAU;YACnB,QAAQ,EAAE,qCAAqC;SAChD;KACF,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,C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D,GAAG,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;KACjC;IACD,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CACtB,WAAW,CAAC,OAAO;SAChB,aAAa,CAAC;QACb,KAAK,EAAE,EAAE;KACV,CAAC;SACD,QAAQ,CAAC;QACR,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;QACjC,gBAAgB,EAAE,KAAK;QACvB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;KACrC,CAAC;SACD,WAAW,EAAE,CACjB,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,kBAAkB,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAChD,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC;YACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;SACpC,CAAC,CAAA;QACF,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;QAChB,OAAO,EAAE,CAAA;IACX,CAAC,CAAC,CAAA;IAEF,MAAM,oBAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;QACpD,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,oBAAoB,MAAM,MAAM,CAAC,gBAAgB,WAAW,MAAM,CAAC,aAAa,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACpI,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACrB,CAAC"}
@@ -1,22 +1,22 @@
1
- import * as anchor from "@coral-xyz/anchor";
2
- import { ThresholdType } from "@helium/circuit-breaker-sdk";
3
- import { dataCreditsKey, init as initDc, PROGRAM_ID, accountPayerKey, } from "@helium/data-credits-sdk";
4
- import { init as initHem, dataOnlyConfigKey, } from "@helium/helium-entity-manager-sdk";
5
- import { fanoutKey } from "@helium/fanout-sdk";
6
- import { daoKey, init as initDao, threadKey, } from "@helium/helium-sub-daos-sdk";
7
- import { sendInstructions, toBN } from "@helium/spl-utils";
8
- import { init as initVsr, registrarKey, } from "@helium/voter-stake-registry-sdk";
9
- import { getGovernanceProgramVersion, GoverningTokenConfigAccountArgs, GoverningTokenType, MintMaxVoteWeightSource, SetRealmAuthorityAction, withCreateRealm, withSetRealmAuthority, } from "@solana/spl-governance";
10
- import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, } from "@solana/spl-token";
11
- import { ComputeBudgetProgram, Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, } from "@solana/web3.js";
12
- import Squads from "@sqds/sdk";
13
- import os from "os";
14
- import yargs from "yargs/yargs";
15
- import { createAndMint, isLocalhost, loadKeypair, parseEmissionsSchedule, sendInstructionsOrSquads, } from "./utils";
16
- import fs from "fs";
17
- import { BN } from "bn.js";
18
- import { getConcurrentMerkleTreeAccountSize, SPL_ACCOUNT_COMPRESSION_PROGRAM_ID } from "@solana/spl-account-compression";
19
- const { hideBin } = require("yargs/helpers");
1
+ import * as anchor from '@coral-xyz/anchor';
2
+ import { ThresholdType } from '@helium/circuit-breaker-sdk';
3
+ import { dataCreditsKey, init as initDc, PROGRAM_ID, accountPayerKey, } from '@helium/data-credits-sdk';
4
+ import { init as initHem, dataOnlyConfigKey, } from '@helium/helium-entity-manager-sdk';
5
+ import { fanoutKey } from '@helium/fanout-sdk';
6
+ import { daoKey, init as initDao, threadKey, } from '@helium/helium-sub-daos-sdk';
7
+ import { sendInstructions, toBN } from '@helium/spl-utils';
8
+ import { init as initVsr, registrarKey, } from '@helium/voter-stake-registry-sdk';
9
+ import { getGovernanceProgramVersion, GoverningTokenConfigAccountArgs, GoverningTokenType, MintMaxVoteWeightSource, SetRealmAuthorityAction, withCreateRealm, withSetRealmAuthority, } from '@solana/spl-governance';
10
+ import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, } from '@solana/spl-token';
11
+ import { ComputeBudgetProgram, Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, } from '@solana/web3.js';
12
+ import Squads from '@sqds/sdk';
13
+ import os from 'os';
14
+ import yargs from 'yargs/yargs';
15
+ import { createAndMint, isLocalhost, loadKeypair, parseEmissionsSchedule, sendInstructionsOrSquads, } from './utils';
16
+ import fs from 'fs';
17
+ import { BN } from 'bn.js';
18
+ import { getConcurrentMerkleTreeAccountSize, SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, } from '@solana/spl-account-compression';
19
+ const { hideBin } = require('yargs/helpers');
20
20
  const HNT_EPOCH_REWARDS = 10000000000;
21
21
  const SECS_PER_DAY = 86400;
22
22
  const SECS_PER_YEAR = 365 * SECS_PER_DAY;
@@ -30,106 +30,107 @@ async function exists(connection, account) {
30
30
  export async function run(args = process.argv) {
31
31
  const yarg = yargs(args).options({
32
32
  wallet: {
33
- alias: "k",
34
- describe: "Anchor wallet keypair",
33
+ alias: 'k',
34
+ describe: 'Anchor wallet keypair',
35
35
  default: `${os.homedir()}/.config/solana/id.json`,
36
36
  },
37
37
  url: {
38
- alias: "u",
39
- default: "http://127.0.0.1:8899",
40
- describe: "The solana url",
38
+ alias: 'u',
39
+ default: 'http://127.0.0.1:8899',
40
+ describe: 'The solana url',
41
41
  },
42
42
  hntKeypair: {
43
- type: "string",
44
- describe: "Keypair of the HNT token",
43
+ type: 'string',
44
+ describe: 'Keypair of the HNT token',
45
45
  default: `${__dirname}/../../keypairs/hnt.json`,
46
46
  },
47
47
  dcKeypair: {
48
- type: "string",
49
- describe: "Keypair of the Data Credit token",
48
+ type: 'string',
49
+ describe: 'Keypair of the Data Credit token',
50
50
  default: `${__dirname}/../../keypairs/dc.json`,
51
51
  },
52
52
  numHnt: {
53
- type: "number",
54
- describe: "Number of HNT tokens to pre mint before assigning authority to lazy distributor",
53
+ type: 'number',
54
+ describe: 'Number of HNT tokens to pre mint before assigning authority to lazy distributor',
55
55
  default: 0,
56
56
  },
57
57
  numDc: {
58
- type: "number",
59
- describe: "Number of DC tokens to pre mint before assigning authority to lazy distributor",
58
+ type: 'number',
59
+ describe: 'Number of DC tokens to pre mint before assigning authority to lazy distributor',
60
60
  default: 1000,
61
61
  },
62
62
  bucket: {
63
- type: "string",
64
- describe: "Bucket URL prefix holding all of the metadata jsons",
65
- default: "https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP",
63
+ type: 'string',
64
+ describe: 'Bucket URL prefix holding all of the metadata jsons',
65
+ default: 'https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP',
66
66
  },
67
67
  emissionSchedulePath: {
68
68
  required: true,
69
- describe: "Path to file that contains the hnt emissions schedule",
70
- type: "string",
69
+ describe: 'Path to file that contains the hnt emissions schedule',
70
+ type: 'string',
71
71
  default: `${__dirname}/../../emissions/hnt.json`,
72
72
  },
73
73
  hstEmissionSchedulePath: {
74
74
  required: true,
75
- describe: "Path to file that contains the hst emissions schedule",
76
- type: "string",
75
+ describe: 'Path to file that contains the hst emissions schedule',
76
+ type: 'string',
77
77
  default: `${__dirname}/../../emissions/hst.json`,
78
78
  },
79
79
  govProgramId: {
80
- type: "string",
81
- describe: "Pubkey of the GOV program",
82
- default: "hgovkRU6Ghe1Qoyb54HdSLdqN7VtxaifBzRmh9jtd3S",
80
+ type: 'string',
81
+ describe: 'Pubkey of the GOV program',
82
+ default: 'hgovkRU6Ghe1Qoyb54HdSLdqN7VtxaifBzRmh9jtd3S',
83
83
  },
84
84
  realmName: {
85
- type: "string",
86
- describe: "Name of the realm to be generated",
87
- default: "Helium",
85
+ type: 'string',
86
+ describe: 'Name of the realm to be generated',
87
+ default: 'Helium',
88
88
  },
89
89
  councilKeypair: {
90
- type: "string",
91
- describe: "Keypair of gov council token",
90
+ type: 'string',
91
+ describe: 'Keypair of gov council token',
92
92
  default: `${__dirname}/../../keypairs/council.json`,
93
93
  },
94
94
  councilWallet: {
95
- type: "string",
96
- describe: "Pubkey for holding/distributing council tokens",
95
+ type: 'string',
96
+ describe: 'Pubkey for holding/distributing council tokens',
97
97
  default: await loadKeypair(`${os.homedir()}/.config/solana/id.json`).publicKey.toBase58(),
98
98
  },
99
99
  numCouncil: {
100
- type: "number",
101
- describe: "Number of Gov Council tokens to pre mint before assigning authority to dao",
100
+ type: 'number',
101
+ describe: 'Number of Gov Council tokens to pre mint before assigning authority to dao',
102
102
  default: 10,
103
103
  },
104
104
  multisig: {
105
- type: "string",
106
- describe: "Address of the squads multisig to control the dao. If not provided, your wallet will be the authority",
105
+ type: 'string',
106
+ describe: 'Address of the squads multisig to control the dao. If not provided, your wallet will be the authority',
107
107
  },
108
108
  authorityIndex: {
109
- type: "number",
110
- describe: "Authority index for squads. Defaults to 1",
109
+ type: 'number',
110
+ describe: 'Authority index for squads. Defaults to 1',
111
111
  default: 1,
112
112
  },
113
113
  hntPriceOracle: {
114
- type: "string",
115
- required: true
114
+ type: 'string',
115
+ required: true,
116
116
  },
117
117
  numHst: {
118
- type: "number",
119
- describe: "Number of HST tokens to pre mint before assigning authority to lazy distributor",
118
+ type: 'number',
119
+ describe: 'Number of HST tokens to pre mint before assigning authority to lazy distributor',
120
120
  default: 0,
121
121
  },
122
122
  merklePath: {
123
- type: "string",
124
- describe: "Path to the merkle keypair",
123
+ type: 'string',
124
+ describe: 'Path to the merkle keypair',
125
125
  default: `${__dirname}/../../keypairs/data-only-merkle.json`,
126
- }
126
+ },
127
127
  });
128
128
  const argv = await yarg.argv;
129
129
  process.env.ANCHOR_WALLET = argv.wallet;
130
130
  process.env.ANCHOR_PROVIDER_URL = argv.url;
131
131
  anchor.setProvider(anchor.AnchorProvider.local(argv.url));
132
132
  const provider = anchor.getProvider();
133
+ const wallet = new anchor.Wallet(loadKeypair(argv.wallet));
133
134
  const dataCreditsProgram = await initDc(provider);
134
135
  const heliumSubDaosProgram = await initDao(provider);
135
136
  const heliumVsrProgram = await initVsr(provider);
@@ -141,17 +142,17 @@ export async function run(args = process.argv) {
141
142
  const dcKeypair = loadKeypair(argv.dcKeypair);
142
143
  const me = provider.wallet.publicKey;
143
144
  const dao = daoKey(hntKeypair.publicKey)[0];
144
- console.log("HNT", hntKeypair.publicKey.toBase58());
145
- console.log("DC", dcKeypair.publicKey.toBase58());
146
- console.log("GOV PID", govProgramId.toBase58());
147
- console.log("COUNCIL", councilKeypair.publicKey.toBase58());
148
- console.log("COUNCIL WALLET", councilWallet.toBase58());
149
- const thread = threadKey(dao, "issue_hst")[0];
150
- console.log("DAO", dao.toString());
151
- console.log("THREAD", thread.toString());
145
+ console.log('HNT', hntKeypair.publicKey.toBase58());
146
+ console.log('DC', dcKeypair.publicKey.toBase58());
147
+ console.log('GOV PID', govProgramId.toBase58());
148
+ console.log('COUNCIL', councilKeypair.publicKey.toBase58());
149
+ console.log('COUNCIL WALLET', councilWallet.toBase58());
150
+ const thread = threadKey(dao, 'issue_hst')[0];
151
+ console.log('DAO', dao.toString());
152
+ console.log('THREAD', thread.toString());
152
153
  const conn = provider.connection;
153
- const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, provider.wallet, {
154
- commitmentOrConfig: "finalized"
154
+ const squads = Squads.endpoint(process.env.ANCHOR_PROVIDER_URL, wallet, {
155
+ commitmentOrConfig: 'finalized',
155
156
  });
156
157
  let authority = provider.wallet.publicKey;
157
158
  let multisig = argv.multisig ? new PublicKey(argv.multisig) : null;
@@ -160,7 +161,7 @@ export async function run(args = process.argv) {
160
161
  // Fund authority
161
162
  const authAcc = await provider.connection.getAccountInfo(authority);
162
163
  if (!authAcc || authAcc.lamports < LAMPORTS_PER_SOL) {
163
- console.log("Funding multisig...");
164
+ console.log('Funding multisig...');
164
165
  await sendInstructions(provider, [
165
166
  await SystemProgram.transfer({
166
167
  fromPubkey: me,
@@ -175,7 +176,7 @@ export async function run(args = process.argv) {
175
176
  mintKeypair: hntKeypair,
176
177
  amount: argv.numHnt,
177
178
  metadataUrl: `${argv.bucket}/hnt.json`,
178
- updateAuthority: authority
179
+ updateAuthority: authority,
179
180
  });
180
181
  await createAndMint({
181
182
  provider,
@@ -195,13 +196,13 @@ export async function run(args = process.argv) {
195
196
  updateAuthority: authority,
196
197
  });
197
198
  let instructions = [];
198
- const govProgramVersion = await getGovernanceProgramVersion(conn, govProgramId, isLocalhost(provider) ? "localnet" : undefined);
199
+ const govProgramVersion = await getGovernanceProgramVersion(conn, govProgramId, isLocalhost(provider) ? 'localnet' : undefined);
199
200
  const realmName = argv.realmName;
200
- const realm = await PublicKey.findProgramAddressSync([Buffer.from("governance", "utf-8"), Buffer.from(realmName, "utf-8")], govProgramId)[0];
201
- console.log("Realm, ", realm.toBase58());
201
+ const realm = await PublicKey.findProgramAddressSync([Buffer.from('governance', 'utf-8'), Buffer.from(realmName, 'utf-8')], govProgramId)[0];
202
+ console.log('Realm, ', realm.toBase58());
202
203
  const needRealmCreate = !(await exists(conn, realm));
203
204
  if (needRealmCreate) {
204
- console.log("Initializing Realm");
205
+ console.log('Initializing Realm');
205
206
  await withCreateRealm(instructions, govProgramId, govProgramVersion, realmName, provider.wallet.publicKey, // realmAuthorityPk
206
207
  hntKeypair.publicKey, // communityMintPk
207
208
  provider.wallet.publicKey, // payer
@@ -223,7 +224,7 @@ export async function run(args = process.argv) {
223
224
  }
224
225
  const registrar = (await registrarKey(realm, hntKeypair.publicKey))[0];
225
226
  if (!(await exists(conn, registrar))) {
226
- console.log("Initializing VSR Registrar");
227
+ console.log('Initializing VSR Registrar');
227
228
  instructions.push(ComputeBudgetProgram.setComputeUnitLimit({ units: 800000 }));
228
229
  instructions.push(await heliumVsrProgram.methods
229
230
  .initializeRegistrarV0({
@@ -237,7 +238,7 @@ export async function run(args = process.argv) {
237
238
  await sendInstructions(provider, instructions, []);
238
239
  instructions = [];
239
240
  }
240
- console.log("Configuring VSR voting mint at [0]");
241
+ console.log('Configuring VSR voting mint at [0]');
241
242
  instructions.push(await heliumVsrProgram.methods
242
243
  .configureVotingMintV0({
243
244
  idx: 0,
@@ -246,7 +247,7 @@ export async function run(args = process.argv) {
246
247
  maxExtraLockupVoteWeightScaledFactor: new anchor.BN(SCALE * 1e9),
247
248
  genesisVotePowerMultiplier: GENESIS_MULTIPLIER,
248
249
  // April 28th, 23:59:59 UTC
249
- genesisVotePowerMultiplierExpirationTs: new anchor.BN("1682726399"),
250
+ genesisVotePowerMultiplierExpirationTs: new anchor.BN('1682726399'),
250
251
  lockupSaturationSecs: new anchor.BN(MAX_LOCKUP),
251
252
  })
252
253
  .accounts({
@@ -263,7 +264,7 @@ export async function run(args = process.argv) {
263
264
  .instruction());
264
265
  await sendInstructions(provider, instructions, []);
265
266
  instructions = [];
266
- console.log("Creating max voter record");
267
+ console.log('Creating max voter record');
267
268
  instructions.push(await heliumVsrProgram.methods
268
269
  .updateMaxVoterWeightV0()
269
270
  .accounts({
@@ -280,7 +281,7 @@ export async function run(args = process.argv) {
280
281
  await sendInstructions(provider, instructions, []);
281
282
  instructions = [];
282
283
  const dcKey = (await dataCreditsKey(dcKeypair.publicKey))[0];
283
- console.log("dcpid", PROGRAM_ID.toBase58());
284
+ console.log('dcpid', PROGRAM_ID.toBase58());
284
285
  if (!(await exists(conn, dcKey))) {
285
286
  await dataCreditsProgram.methods
286
287
  .initializeDataCreditsV0({
@@ -288,7 +289,7 @@ export async function run(args = process.argv) {
288
289
  config: {
289
290
  windowSizeSeconds: new anchor.BN(60 * 60),
290
291
  thresholdType: ThresholdType.Absolute,
291
- threshold: new anchor.BN("1000000000000"),
292
+ threshold: new anchor.BN('1000000000000'),
292
293
  },
293
294
  })
294
295
  .accounts({
@@ -308,12 +309,12 @@ export async function run(args = process.argv) {
308
309
  await provider.sendAndConfirm(tx);
309
310
  }
310
311
  if (!(await exists(conn, dao))) {
311
- console.log("Initializing DAO");
312
+ console.log('Initializing DAO');
312
313
  const hstEmission = await parseEmissionsSchedule(argv.hstEmissionSchedulePath);
313
314
  const hntEmission = await parseEmissionsSchedule(argv.emissionSchedulePath);
314
315
  const currentHstEmission = hstEmission[0];
315
316
  const currentHntEmission = hntEmission[0];
316
- const fanout = fanoutKey("HST")[0];
317
+ const fanout = fanoutKey('HST')[0];
317
318
  const hstPool = getAssociatedTokenAddressSync(hntKeypair.publicKey, fanout, true);
318
319
  await heliumSubDaosProgram.methods
319
320
  .initializeDaoV0({
@@ -393,15 +394,15 @@ export async function run(args = process.argv) {
393
394
  newTreeBufferSize: buffer,
394
395
  newTreeSpace: new BN(getConcurrentMerkleTreeAccountSize(size, buffer, canopy)),
395
396
  newTreeFeeLamports: new BN(cost / 2 ** size),
396
- name: "DATAONLY",
397
- metadataUrl: "https://shdw-drive.genesysgo.net/H8b1gZmA2aBqDYxicxawGpznCaNbFSEJ3YnJuawGQ2EQ/data-only.json",
397
+ name: 'DATAONLY',
398
+ metadataUrl: 'https://shdw-drive.genesysgo.net/H8b1gZmA2aBqDYxicxawGpznCaNbFSEJ3YnJuawGQ2EQ/data-only.json',
398
399
  })
399
400
  .accounts({
400
401
  dao,
401
402
  authority,
402
403
  merkleTree: merkle.publicKey,
403
404
  })
404
- .instruction()
405
+ .instruction(),
405
406
  ],
406
407
  executeTransaction: false,
407
408
  squads,