@helium/automation-hooks 0.10.7

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 (33) hide show
  1. package/LICENSE +203 -0
  2. package/lib/cjs/hooks/index.js +10 -0
  3. package/lib/cjs/hooks/index.js.map +1 -0
  4. package/lib/cjs/hooks/useAutomateHotspotClaims.js +267 -0
  5. package/lib/cjs/hooks/useAutomateHotspotClaims.js.map +1 -0
  6. package/lib/cjs/hooks/useCronJob.js +7 -0
  7. package/lib/cjs/hooks/useCronJob.js.map +1 -0
  8. package/lib/cjs/hooks/useTaskQueue.js +7 -0
  9. package/lib/cjs/hooks/useTaskQueue.js.map +1 -0
  10. package/lib/cjs/index.js +18 -0
  11. package/lib/cjs/index.js.map +1 -0
  12. package/lib/esm/src/hooks/index.js +4 -0
  13. package/lib/esm/src/hooks/index.js.map +1 -0
  14. package/lib/esm/src/hooks/useAutomateHotspotClaims.js +252 -0
  15. package/lib/esm/src/hooks/useAutomateHotspotClaims.js.map +1 -0
  16. package/lib/esm/src/hooks/useCronJob.js +3 -0
  17. package/lib/esm/src/hooks/useCronJob.js.map +1 -0
  18. package/lib/esm/src/hooks/useTaskQueue.js +3 -0
  19. package/lib/esm/src/hooks/useTaskQueue.js.map +1 -0
  20. package/lib/esm/src/index.js +2 -0
  21. package/lib/esm/src/index.js.map +1 -0
  22. package/lib/esm/tsconfig.esm.tsbuildinfo +1 -0
  23. package/lib/types/src/hooks/index.d.ts +4 -0
  24. package/lib/types/src/hooks/index.d.ts.map +1 -0
  25. package/lib/types/src/hooks/useAutomateHotspotClaims.d.ts +53 -0
  26. package/lib/types/src/hooks/useAutomateHotspotClaims.d.ts.map +1 -0
  27. package/lib/types/src/hooks/useCronJob.d.ts +21 -0
  28. package/lib/types/src/hooks/useCronJob.d.ts.map +1 -0
  29. package/lib/types/src/hooks/useTaskQueue.d.ts +23 -0
  30. package/lib/types/src/hooks/useTaskQueue.d.ts.map +1 -0
  31. package/lib/types/src/index.d.ts +2 -0
  32. package/lib/types/src/index.d.ts.map +1 -0
  33. package/package.json +59 -0
@@ -0,0 +1,53 @@
1
+ /// <reference types="bn.js" />
2
+ import { PublicKey, TransactionInstruction } from '@solana/web3.js';
3
+ import { AnchorProvider } from '@coral-xyz/anchor';
4
+ type Schedule = 'daily' | 'weekly' | 'monthly';
5
+ export declare const interpretCronString: (cronString: string) => {
6
+ schedule: Schedule;
7
+ time: string;
8
+ nextRun: Date;
9
+ };
10
+ export declare const useAutomateHotspotClaims: ({ schedule, duration, totalHotspots, wallet, provider: providerRaw }: {
11
+ schedule: Schedule;
12
+ duration: number;
13
+ totalHotspots: number;
14
+ wallet?: PublicKey | undefined;
15
+ provider?: AnchorProvider | undefined;
16
+ }) => {
17
+ loading: boolean;
18
+ error: Error | undefined;
19
+ execute: (params: {
20
+ onInstructions?: ((instructions: TransactionInstruction[]) => Promise<void>) | undefined;
21
+ }) => Promise<void>;
22
+ remove: (params: {
23
+ onInstructions?: ((instructions: any) => Promise<void>) | undefined;
24
+ }) => Promise<void>;
25
+ hasExistingAutomation: boolean;
26
+ cron: {
27
+ id: number;
28
+ userCronJobs: PublicKey;
29
+ taskQueue: PublicKey;
30
+ authority: PublicKey;
31
+ freeTasksPerTransaction: number;
32
+ numTasksPerQueueCall: number;
33
+ schedule: string;
34
+ name: string;
35
+ currentExecTs: import("bn.js");
36
+ currentTransactionId: number;
37
+ numTransactions: number;
38
+ nextTransactionId: number;
39
+ removedFromQueue: boolean;
40
+ bumpSeed: number;
41
+ } | undefined;
42
+ currentSchedule: {
43
+ schedule: Schedule;
44
+ time: string;
45
+ nextRun: Date;
46
+ } | undefined;
47
+ rentFee: number;
48
+ solFee: number;
49
+ insufficientSol: boolean;
50
+ isOutOfSol: boolean;
51
+ };
52
+ export {};
53
+ //# sourceMappingURL=useAutomateHotspotClaims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutomateHotspotClaims.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAutomateHotspotClaims.ts"],"names":[],"mappings":";AAgBA,OAAO,EAEL,SAAS,EAET,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AAKxB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;AA+B9C,eAAO,MAAM,mBAAmB,eAClB,MAAM;cAER,QAAQ;UACZ,MAAM;aACH,IAAI;CA8Dd,CAAA;AAID,eAAO,MAAM,wBAAwB;cAOzB,QAAQ;cACR,MAAM;mBACD,MAAM;;;;;;;yCAuCe,sBAAsB,EAAE,KAAK,QAAQ,IAAI,CAAC;;;yCA0I1C,GAAG,KAAK,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;kBA9P/C,QAAQ;cACZ,MAAM;iBACH,IAAI;;;;;;CA0Td,CAAA"}
@@ -0,0 +1,21 @@
1
+ /// <reference types="bn.js" />
2
+ import { PublicKey } from '@solana/web3.js';
3
+ export declare const useCronJob: (cronJobKey: PublicKey | undefined) => import("@helium/account-fetch-cache-hooks").UseAccountState<{
4
+ id: number;
5
+ userCronJobs: PublicKey;
6
+ taskQueue: PublicKey;
7
+ authority: PublicKey;
8
+ freeTasksPerTransaction: number;
9
+ numTasksPerQueueCall: number;
10
+ schedule: string;
11
+ name: string;
12
+ currentExecTs: import("bn.js");
13
+ currentTransactionId: number;
14
+ numTransactions: number;
15
+ nextTransactionId: number;
16
+ removedFromQueue: boolean;
17
+ bumpSeed: number;
18
+ }> & {
19
+ error?: Error | undefined;
20
+ };
21
+ //# sourceMappingURL=useCronJob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCronJob.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCronJob.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,eAAO,MAAM,UAAU,eAAgB,SAAS,GAAG,SAAS;;;;;;;;;;;;;;;;;CACE,CAAA"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="bn.js" />
2
+ /// <reference types="node" />
3
+ import { PublicKey } from '@solana/web3.js';
4
+ export declare const useTaskQueue: (taskQueueKey: PublicKey | undefined) => import("@helium/account-fetch-cache-hooks").UseAccountState<{
5
+ tuktukConfig: PublicKey;
6
+ id: number;
7
+ updateAuthority: PublicKey;
8
+ reserved: PublicKey;
9
+ minCrankReward: import("bn.js");
10
+ uncollectedProtocolFees: import("bn.js");
11
+ capacity: number;
12
+ createdAt: import("bn.js");
13
+ updatedAt: import("bn.js");
14
+ bumpSeed: number;
15
+ taskBitmap: Buffer;
16
+ name: string;
17
+ lookupTables: PublicKey[];
18
+ numQueueAuthorities: number;
19
+ staleTaskAge: number;
20
+ }> & {
21
+ error?: Error | undefined;
22
+ };
23
+ //# sourceMappingURL=useTaskQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTaskQueue.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTaskQueue.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,eAAO,MAAM,YAAY,iBAAkB,SAAS,GAAG,SAAS;;;;;;;;;;;;;;;;;;CACM,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./hooks/index";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@helium/automation-hooks",
3
+ "publishConfig": {
4
+ "access": "public",
5
+ "registry": "https://registry.npmjs.org/"
6
+ },
7
+ "license": "Apache-2.0",
8
+ "version": "0.10.7",
9
+ "description": "React hooks for helium automation",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/helium/helium-program-libary"
13
+ },
14
+ "main": "./lib/cjs/index.js",
15
+ "module": "./lib/esm/src/index.js",
16
+ "types": "./lib/types/src/index.d.ts",
17
+ "sideEffects": false,
18
+ "files": [
19
+ "lib"
20
+ ],
21
+ "exports": {
22
+ "import": "./lib/esm/src/index.js",
23
+ "require": "./lib/cjs/index.js",
24
+ "types": "./lib/types/src/index.d.ts"
25
+ },
26
+ "scripts": {
27
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
28
+ "precommit": "npx git-format-staged -f 'prettier --ignore-unknown --stdin --stdin-filepath \"{}\"' .",
29
+ "clean": "npx shx mkdir -p lib && npx shx rm -rf lib",
30
+ "package": "npx shx mkdir -p lib/cjs lib/esm",
31
+ "prebuild": "npm run clean && npm run package"
32
+ },
33
+ "dependencies": {
34
+ "@coral-xyz/anchor": "^0.31.0",
35
+ "@helium/account-fetch-cache": "^0.10.7",
36
+ "@helium/account-fetch-cache-hooks": "^0.10.7",
37
+ "@helium/hpl-crons-sdk": "^0.10.7",
38
+ "@helium/spl-utils": "^0.10.7",
39
+ "@helium/tuktuk-sdk": "^0.0.8",
40
+ "@solana/wallet-adapter-base": "^0.9.22",
41
+ "@solana/web3.js": "^1.91.1",
42
+ "axios": "^1.3.6",
43
+ "bs58": "^4.0.1",
44
+ "react-async-hook": "^4.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "git-format-staged": "^2.1.3",
48
+ "ts-loader": "^9.2.3",
49
+ "typescript": "^5.2.2"
50
+ },
51
+ "peerDependencies": {
52
+ "@solana/wallet-adapter-react": "^0.15.32",
53
+ "react": "^16.8 || ^17 || ^18",
54
+ "react-dom": "^16.8 || ^17 || ^18"
55
+ },
56
+ "keywords": [],
57
+ "author": "",
58
+ "gitHead": "e5b777f4050cb03ee8ce9770067cbfa4a17f97d4"
59
+ }