psyche-indexer-codecs 0.0.1 → 0.0.2
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/dist/index.d.ts +69 -24
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/features/CoordinatorRun.ts +22 -0
- package/src/features/MiningPool.ts +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import * as solana_kiss from 'solana-kiss';
|
|
2
|
-
import { JsonCodecContent,
|
|
2
|
+
import { JsonCodecContent, Pubkey, JsonCodec } from 'solana-kiss';
|
|
3
3
|
|
|
4
|
+
declare function coordinatorRunAddressFromId(programAddress: Pubkey, runId: string): Pubkey;
|
|
4
5
|
type CoordinatorRunOnchain = JsonCodecContent<typeof coordinatorRunOnchainJsonCodec>;
|
|
5
6
|
type CoordinatorRunSample = JsonCodecContent<typeof coordinatorRunSampleJsonCodec>;
|
|
7
|
+
type CoordinatorRunSummary = JsonCodecContent<typeof coordinatorRunSummaryJsonCodec>;
|
|
6
8
|
type CoordinatorRunAnalysis = JsonCodecContent<typeof coordinatorRunAnalysisJsonCodec>;
|
|
7
9
|
declare const coordinatorRunOnchainJsonCodec: solana_kiss.JsonCodec<{
|
|
8
10
|
runId: string;
|
|
9
|
-
mainAuthority:
|
|
10
|
-
joinAuthority:
|
|
11
|
+
mainAuthority: Pubkey;
|
|
12
|
+
joinAuthority: Pubkey;
|
|
11
13
|
name: string;
|
|
12
14
|
description: string;
|
|
13
15
|
status: string;
|
|
14
16
|
numParameters: bigint;
|
|
15
17
|
joinedClients: {
|
|
16
|
-
signer:
|
|
18
|
+
signer: Pubkey;
|
|
17
19
|
earned: bigint;
|
|
18
20
|
slashed: bigint;
|
|
19
21
|
}[];
|
|
20
22
|
epochClients: {
|
|
21
|
-
signer:
|
|
23
|
+
signer: Pubkey;
|
|
22
24
|
state: string;
|
|
23
25
|
}[];
|
|
24
26
|
progress: {
|
|
@@ -33,25 +35,50 @@ declare const coordinatorRunSampleJsonCodec: solana_kiss.JsonCodec<{
|
|
|
33
35
|
numValue: number;
|
|
34
36
|
time: Date | null;
|
|
35
37
|
}>;
|
|
38
|
+
declare const coordinatorRunSummaryJsonCodec: solana_kiss.JsonCodec<{
|
|
39
|
+
address: Pubkey;
|
|
40
|
+
state: {
|
|
41
|
+
runId: string;
|
|
42
|
+
mainAuthority: Pubkey;
|
|
43
|
+
joinAuthority: Pubkey;
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
status: string;
|
|
47
|
+
numParameters: bigint;
|
|
48
|
+
joinedClients: {
|
|
49
|
+
signer: Pubkey;
|
|
50
|
+
earned: bigint;
|
|
51
|
+
slashed: bigint;
|
|
52
|
+
}[];
|
|
53
|
+
epochClients: {
|
|
54
|
+
signer: Pubkey;
|
|
55
|
+
state: string;
|
|
56
|
+
}[];
|
|
57
|
+
progress: {
|
|
58
|
+
epoch: number;
|
|
59
|
+
step: number;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
36
63
|
declare const coordinatorRunAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
37
64
|
latestKnownChangeOrdinal: bigint;
|
|
38
65
|
latestUpdateFetchOrdinal: bigint;
|
|
39
66
|
latestOnchainSnapshot: {
|
|
40
67
|
parsed: {
|
|
41
68
|
runId: string;
|
|
42
|
-
mainAuthority:
|
|
43
|
-
joinAuthority:
|
|
69
|
+
mainAuthority: Pubkey;
|
|
70
|
+
joinAuthority: Pubkey;
|
|
44
71
|
name: string;
|
|
45
72
|
description: string;
|
|
46
73
|
status: string;
|
|
47
74
|
numParameters: bigint;
|
|
48
75
|
joinedClients: {
|
|
49
|
-
signer:
|
|
76
|
+
signer: Pubkey;
|
|
50
77
|
earned: bigint;
|
|
51
78
|
slashed: bigint;
|
|
52
79
|
}[];
|
|
53
80
|
epochClients: {
|
|
54
|
-
signer:
|
|
81
|
+
signer: Pubkey;
|
|
55
82
|
state: string;
|
|
56
83
|
}[];
|
|
57
84
|
progress: {
|
|
@@ -65,7 +92,7 @@ declare const coordinatorRunAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
|
65
92
|
};
|
|
66
93
|
updatedAt: Date;
|
|
67
94
|
} | null;
|
|
68
|
-
lastWitnessByUser: Map<
|
|
95
|
+
lastWitnessByUser: Map<Pubkey, {
|
|
69
96
|
ordinal: bigint;
|
|
70
97
|
step: number;
|
|
71
98
|
}>;
|
|
@@ -80,19 +107,19 @@ declare const coordinatorRunAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
|
80
107
|
blockTime: Date | null;
|
|
81
108
|
instructionOrdinal: bigint;
|
|
82
109
|
instructionName: string;
|
|
83
|
-
instructionAddresses: Record<string,
|
|
110
|
+
instructionAddresses: Record<string, Pubkey>;
|
|
84
111
|
instructionPayload: solana_kiss.JsonValue;
|
|
85
112
|
}[];
|
|
86
113
|
joinHistory: {
|
|
87
114
|
blockTime: Date | null;
|
|
88
115
|
instructionOrdinal: bigint;
|
|
89
|
-
user:
|
|
90
|
-
p2pIdentity:
|
|
116
|
+
user: Pubkey;
|
|
117
|
+
p2pIdentity: Pubkey;
|
|
91
118
|
}[];
|
|
92
119
|
checkpointHistory: {
|
|
93
120
|
blockTime: Date | null;
|
|
94
121
|
instructionOrdinal: bigint;
|
|
95
|
-
user:
|
|
122
|
+
user: Pubkey;
|
|
96
123
|
repo: {
|
|
97
124
|
repoId: string;
|
|
98
125
|
revision: string | null;
|
|
@@ -101,21 +128,39 @@ declare const coordinatorRunAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
|
101
128
|
finishesOrdinals: bigint[];
|
|
102
129
|
}>;
|
|
103
130
|
|
|
131
|
+
declare function miningPoolAddressFromIndex(programAddress: Pubkey, poolIndex: bigint): Pubkey;
|
|
104
132
|
type MiningPoolOnchain = JsonCodecContent<typeof miningPoolOnchainJsonCodec>;
|
|
133
|
+
type MiningPoolSummary = JsonCodecContent<typeof miningPoolSummaryJsonCodec>;
|
|
105
134
|
type MiningPoolAnalysis = JsonCodecContent<typeof miningPoolAnalysisJsonCodec>;
|
|
106
135
|
declare const miningPoolOnchainJsonCodec: solana_kiss.JsonCodec<{
|
|
107
136
|
bump: number;
|
|
108
137
|
index: bigint;
|
|
109
|
-
authority:
|
|
110
|
-
collateralMint:
|
|
138
|
+
authority: Pubkey;
|
|
139
|
+
collateralMint: Pubkey;
|
|
111
140
|
maxDepositCollateralAmount: bigint;
|
|
112
141
|
totalDepositedCollateralAmount: bigint;
|
|
113
142
|
totalExtractedCollateralAmount: bigint;
|
|
114
143
|
claimingEnabled: boolean;
|
|
115
|
-
redeemableMint:
|
|
144
|
+
redeemableMint: Pubkey;
|
|
116
145
|
totalClaimedRedeemableAmount: bigint;
|
|
117
146
|
freeze: boolean;
|
|
118
147
|
}>;
|
|
148
|
+
declare const miningPoolSummaryJsonCodec: solana_kiss.JsonCodec<{
|
|
149
|
+
address: Pubkey;
|
|
150
|
+
state: {
|
|
151
|
+
bump: number;
|
|
152
|
+
index: bigint;
|
|
153
|
+
authority: Pubkey;
|
|
154
|
+
collateralMint: Pubkey;
|
|
155
|
+
maxDepositCollateralAmount: bigint;
|
|
156
|
+
totalDepositedCollateralAmount: bigint;
|
|
157
|
+
totalExtractedCollateralAmount: bigint;
|
|
158
|
+
claimingEnabled: boolean;
|
|
159
|
+
redeemableMint: Pubkey;
|
|
160
|
+
totalClaimedRedeemableAmount: bigint;
|
|
161
|
+
freeze: boolean;
|
|
162
|
+
};
|
|
163
|
+
}>;
|
|
119
164
|
declare const miningPoolAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
120
165
|
latestKnownChangeOrdinal: bigint;
|
|
121
166
|
latestUpdateFetchOrdinal: bigint;
|
|
@@ -123,21 +168,21 @@ declare const miningPoolAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
|
123
168
|
parsed: {
|
|
124
169
|
bump: number;
|
|
125
170
|
index: bigint;
|
|
126
|
-
authority:
|
|
127
|
-
collateralMint:
|
|
171
|
+
authority: Pubkey;
|
|
172
|
+
collateralMint: Pubkey;
|
|
128
173
|
maxDepositCollateralAmount: bigint;
|
|
129
174
|
totalDepositedCollateralAmount: bigint;
|
|
130
175
|
totalExtractedCollateralAmount: bigint;
|
|
131
176
|
claimingEnabled: boolean;
|
|
132
|
-
redeemableMint:
|
|
177
|
+
redeemableMint: Pubkey;
|
|
133
178
|
totalClaimedRedeemableAmount: bigint;
|
|
134
179
|
freeze: boolean;
|
|
135
180
|
};
|
|
136
181
|
native: solana_kiss.JsonValue;
|
|
137
182
|
updatedAt: Date;
|
|
138
183
|
} | null;
|
|
139
|
-
depositCollateralAmountPerUser: Map<
|
|
140
|
-
claimRedeemableAmountPerUser: Map<
|
|
184
|
+
depositCollateralAmountPerUser: Map<Pubkey, bigint>;
|
|
185
|
+
claimRedeemableAmountPerUser: Map<Pubkey, bigint>;
|
|
141
186
|
totalDepositCollateralAmount: bigint;
|
|
142
187
|
totalClaimRedeemableAmount: bigint;
|
|
143
188
|
totalExtractCollateralAmount: bigint;
|
|
@@ -145,7 +190,7 @@ declare const miningPoolAnalysisJsonCodec: solana_kiss.JsonCodec<{
|
|
|
145
190
|
blockTime: Date | null;
|
|
146
191
|
instructionOrdinal: bigint;
|
|
147
192
|
instructionName: string;
|
|
148
|
-
instructionAddresses: Record<string,
|
|
193
|
+
instructionAddresses: Record<string, Pubkey>;
|
|
149
194
|
instructionPayload: solana_kiss.JsonValue;
|
|
150
195
|
}[];
|
|
151
196
|
}>;
|
|
@@ -160,4 +205,4 @@ declare const indexedInstructionJsonCodec: JsonCodec<{
|
|
|
160
205
|
instructionPayload: solana_kiss.JsonValue;
|
|
161
206
|
}>;
|
|
162
207
|
|
|
163
|
-
export { type CoordinatorRunAnalysis, type CoordinatorRunOnchain, type CoordinatorRunSample, type IndexedInstruction, type MiningPoolAnalysis, type MiningPoolOnchain, coordinatorRunAnalysisJsonCodec, coordinatorRunOnchainJsonCodec, indexedInstructionJsonCodec, jsonCodecObjectToMapByPubkey, miningPoolAnalysisJsonCodec, miningPoolOnchainJsonCodec };
|
|
208
|
+
export { type CoordinatorRunAnalysis, type CoordinatorRunOnchain, type CoordinatorRunSample, type CoordinatorRunSummary, type IndexedInstruction, type MiningPoolAnalysis, type MiningPoolOnchain, type MiningPoolSummary, coordinatorRunAddressFromId, coordinatorRunAnalysisJsonCodec, coordinatorRunOnchainJsonCodec, coordinatorRunSummaryJsonCodec, indexedInstructionJsonCodec, jsonCodecObjectToMapByPubkey, miningPoolAddressFromIndex, miningPoolAnalysisJsonCodec, miningPoolOnchainJsonCodec, miningPoolSummaryJsonCodec };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var j=(t,r)=>{for(var s in r)c(t,s,{get:r[s],enumerable:!0})},b=(t,r,s,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of m(r))!y.call(t,a)&&a!==s&&c(t,a,{get:()=>r[a],enumerable:!(u=p(r,a))||u.enumerable});return t};var x=t=>b(c({},"__esModule",{value:!0}),t);var h={};j(h,{coordinatorRunAddressFromId:()=>J,coordinatorRunAnalysisJsonCodec:()=>O,coordinatorRunOnchainJsonCodec:()=>l,coordinatorRunSummaryJsonCodec:()=>P,indexedInstructionJsonCodec:()=>i,jsonCodecObjectToMapByPubkey:()=>d,miningPoolAddressFromIndex:()=>f,miningPoolAnalysisJsonCodec:()=>k,miningPoolOnchainJsonCodec:()=>C,miningPoolSummaryJsonCodec:()=>g});module.exports=x(h);var o=require("solana-kiss");var n=require("solana-kiss");function d(t){return(0,n.jsonCodecObjectToMap)({keyCodec:{decoder:n.pubkeyFromBase58,encoder:n.pubkeyToBase58},valueCodec:t})}var i=(0,n.jsonCodecObjectToObject)({blockTime:(0,n.jsonCodecNullable)(n.jsonCodecDateTime),instructionOrdinal:n.jsonCodecBigInt,instructionName:n.jsonCodecString,instructionAddresses:(0,n.jsonCodecObjectToRecord)(n.jsonCodecPubkey),instructionPayload:n.jsonCodecValue});function J(t,r){return(0,o.pubkeyFindPdaAddress)(t,[(0,o.utf8Encode)("coordinator"),(0,o.utf8Encode)(r).slice(0,32)])}var l=(0,o.jsonCodecObjectToObject)({runId:o.jsonCodecString,mainAuthority:o.jsonCodecPubkey,joinAuthority:o.jsonCodecPubkey,name:o.jsonCodecString,description:o.jsonCodecString,status:o.jsonCodecString,numParameters:o.jsonCodecBigInt,joinedClients:(0,o.jsonCodecArrayToArray)((0,o.jsonCodecObjectToObject)({signer:o.jsonCodecPubkey,earned:o.jsonCodecBigInt,slashed:o.jsonCodecBigInt})),epochClients:(0,o.jsonCodecArrayToArray)((0,o.jsonCodecObjectToObject)({signer:o.jsonCodecPubkey,state:o.jsonCodecString})),progress:(0,o.jsonCodecObjectToObject)({epoch:o.jsonCodecNumber,step:o.jsonCodecNumber})}),A=(0,o.jsonCodecArrayToObject)({maxOrdinal:o.jsonCodecBigInt,step:o.jsonCodecNumber,sumValue:o.jsonCodecNumber,numValue:o.jsonCodecNumber,time:(0,o.jsonCodecNullable)(o.jsonCodecDateTime)}),P=(0,o.jsonCodecObjectToObject)({address:o.jsonCodecPubkey,state:l}),O=(0,o.jsonCodecObjectToObject)({latestKnownChangeOrdinal:o.jsonCodecBigInt,latestUpdateFetchOrdinal:o.jsonCodecBigInt,latestOnchainSnapshot:(0,o.jsonCodecNullable)((0,o.jsonCodecObjectToObject)({parsed:l,native:(0,o.jsonCodecObjectToObject)({coordinatorInstance:o.jsonCodecValue,coordinatorAccount:o.jsonCodecValue}),updatedAt:o.jsonCodecDateTime})),lastWitnessByUser:d((0,o.jsonCodecObjectToObject)({ordinal:o.jsonCodecBigInt,step:o.jsonCodecNumber})),samplesByStatName:(0,o.jsonCodecObjectToMap)({keyCodec:{decoder:t=>t,encoder:t=>t},valueCodec:(0,o.jsonCodecArrayToArray)(A)}),adminHistory:(0,o.jsonCodecArrayToArray)(i),joinHistory:(0,o.jsonCodecArrayToArray)((0,o.jsonCodecObjectToObject)({blockTime:(0,o.jsonCodecNullable)(o.jsonCodecDateTime),instructionOrdinal:o.jsonCodecBigInt,user:o.jsonCodecPubkey,p2pIdentity:o.jsonCodecPubkey})),checkpointHistory:(0,o.jsonCodecArrayToArray)((0,o.jsonCodecObjectToObject)({blockTime:(0,o.jsonCodecNullable)(o.jsonCodecDateTime),instructionOrdinal:o.jsonCodecBigInt,user:o.jsonCodecPubkey,repo:(0,o.jsonCodecObjectToObject)({repoId:o.jsonCodecString,revision:(0,o.jsonCodecNullable)(o.jsonCodecString)})})),finishesOrdinals:(0,o.jsonCodecArrayToArray)(o.jsonCodecBigInt)});var e=require("solana-kiss");function f(t,r){let s=new Uint8Array(8);return new DataView(s.buffer).setBigUint64(0,r,!0),(0,e.pubkeyFindPdaAddress)(t,[(0,e.utf8Encode)("Pool"),s])}var C=(0,e.jsonCodecObjectToObject)({bump:e.jsonCodecNumber,index:e.jsonCodecBigInt,authority:e.jsonCodecPubkey,collateralMint:e.jsonCodecPubkey,maxDepositCollateralAmount:e.jsonCodecBigInt,totalDepositedCollateralAmount:e.jsonCodecBigInt,totalExtractedCollateralAmount:e.jsonCodecBigInt,claimingEnabled:e.jsonCodecBoolean,redeemableMint:e.jsonCodecPubkey,totalClaimedRedeemableAmount:e.jsonCodecBigInt,freeze:e.jsonCodecBoolean}),g=(0,e.jsonCodecObjectToObject)({address:e.jsonCodecPubkey,state:C}),k=(0,e.jsonCodecObjectToObject)({latestKnownChangeOrdinal:e.jsonCodecBigInt,latestUpdateFetchOrdinal:e.jsonCodecBigInt,latestOnchainSnapshot:(0,e.jsonCodecNullable)((0,e.jsonCodecObjectToObject)({parsed:C,native:e.jsonCodecValue,updatedAt:e.jsonCodecDateTime})),depositCollateralAmountPerUser:d(e.jsonCodecBigInt),claimRedeemableAmountPerUser:d(e.jsonCodecBigInt),totalDepositCollateralAmount:e.jsonCodecBigInt,totalClaimRedeemableAmount:e.jsonCodecBigInt,totalExtractCollateralAmount:e.jsonCodecBigInt,adminHistory:(0,e.jsonCodecArrayToArray)(i)});0&&(module.exports={coordinatorRunAddressFromId,coordinatorRunAnalysisJsonCodec,coordinatorRunOnchainJsonCodec,coordinatorRunSummaryJsonCodec,indexedInstructionJsonCodec,jsonCodecObjectToMapByPubkey,miningPoolAddressFromIndex,miningPoolAnalysisJsonCodec,miningPoolOnchainJsonCodec,miningPoolSummaryJsonCodec});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/features/CoordinatorRun.ts","../src/utils.ts","../src/features/MiningPool.ts"],"sourcesContent":["export * from \"./features/CoordinatorRun\";\nexport * from \"./features/MiningPool\";\nexport * from \"./utils\";\n","import {\n jsonCodecArrayToArray,\n jsonCodecArrayToObject,\n jsonCodecBigInt,\n JsonCodecContent,\n jsonCodecDateTime,\n jsonCodecNullable,\n jsonCodecNumber,\n jsonCodecObjectToMap,\n jsonCodecObjectToObject,\n jsonCodecPubkey,\n jsonCodecString,\n jsonCodecValue,\n} from \"solana-kiss\";\nimport {\n indexedInstructionJsonCodec,\n jsonCodecObjectToMapByPubkey,\n} from \"../utils\";\n\nexport type CoordinatorRunOnchain = JsonCodecContent<\n typeof coordinatorRunOnchainJsonCodec\n>;\n\nexport type CoordinatorRunSample = JsonCodecContent<\n typeof coordinatorRunSampleJsonCodec\n>;\n\nexport type CoordinatorRunAnalysis = JsonCodecContent<\n typeof coordinatorRunAnalysisJsonCodec\n>;\n\nexport const coordinatorRunOnchainJsonCodec = jsonCodecObjectToObject({\n runId: jsonCodecString,\n mainAuthority: jsonCodecPubkey,\n joinAuthority: jsonCodecPubkey,\n name: jsonCodecString,\n description: jsonCodecString,\n status: jsonCodecString,\n numParameters: jsonCodecBigInt,\n joinedClients: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n signer: jsonCodecPubkey,\n earned: jsonCodecBigInt,\n slashed: jsonCodecBigInt,\n }),\n ),\n epochClients: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n signer: jsonCodecPubkey,\n state: jsonCodecString,\n }),\n ),\n /*\n epochRates: jsonCodecObjectToObject({\n current: jsonCodecObjectToObject({\n earningRate: jsonCodecBigInt,\n slashingRate: jsonCodecBigInt,\n }),\n future: jsonCodecObjectToObject({\n earningRate: jsonCodecBigInt,\n slashingRate: jsonCodecBigInt,\n }),\n }),\n */\n progress: jsonCodecObjectToObject({\n epoch: jsonCodecNumber,\n step: jsonCodecNumber,\n }),\n});\n\nconst coordinatorRunSampleJsonCodec = jsonCodecArrayToObject({\n maxOrdinal: jsonCodecBigInt,\n step: jsonCodecNumber,\n sumValue: jsonCodecNumber,\n numValue: jsonCodecNumber,\n time: jsonCodecNullable(jsonCodecDateTime),\n});\n\nexport const coordinatorRunAnalysisJsonCodec = jsonCodecObjectToObject({\n latestKnownChangeOrdinal: jsonCodecBigInt,\n latestUpdateFetchOrdinal: jsonCodecBigInt,\n latestOnchainSnapshot: jsonCodecNullable(\n jsonCodecObjectToObject({\n parsed: coordinatorRunOnchainJsonCodec,\n native: jsonCodecObjectToObject({\n coordinatorInstance: jsonCodecValue,\n coordinatorAccount: jsonCodecValue,\n }),\n updatedAt: jsonCodecDateTime,\n }),\n ),\n lastWitnessByUser: jsonCodecObjectToMapByPubkey(\n jsonCodecObjectToObject({\n ordinal: jsonCodecBigInt,\n step: jsonCodecNumber,\n }),\n ),\n samplesByStatName: jsonCodecObjectToMap({\n keyCodec: {\n decoder: (name) => name,\n encoder: (name) => name,\n },\n valueCodec: jsonCodecArrayToArray(coordinatorRunSampleJsonCodec),\n }),\n adminHistory: jsonCodecArrayToArray(indexedInstructionJsonCodec),\n joinHistory: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n blockTime: jsonCodecNullable(jsonCodecDateTime),\n instructionOrdinal: jsonCodecBigInt,\n user: jsonCodecPubkey,\n p2pIdentity: jsonCodecPubkey,\n }),\n ),\n checkpointHistory: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n blockTime: jsonCodecNullable(jsonCodecDateTime),\n instructionOrdinal: jsonCodecBigInt,\n user: jsonCodecPubkey,\n repo: jsonCodecObjectToObject({\n repoId: jsonCodecString,\n revision: jsonCodecNullable(jsonCodecString),\n }),\n }),\n ),\n finishesOrdinals: jsonCodecArrayToArray(jsonCodecBigInt),\n});\n","import {\n JsonCodec,\n JsonCodecContent,\n Pubkey,\n jsonCodecBigInt,\n jsonCodecDateTime,\n jsonCodecNullable,\n jsonCodecObjectToMap,\n jsonCodecObjectToObject,\n jsonCodecObjectToRecord,\n jsonCodecPubkey,\n jsonCodecString,\n jsonCodecValue,\n pubkeyFromBase58,\n pubkeyToBase58,\n} from \"solana-kiss\";\n\nexport function jsonCodecObjectToMapByPubkey<T>(\n valueCodec: JsonCodec<T>,\n): JsonCodec<Map<Pubkey, T>> {\n return jsonCodecObjectToMap({\n keyCodec: {\n decoder: pubkeyFromBase58,\n encoder: pubkeyToBase58,\n },\n valueCodec,\n });\n}\n\nexport type IndexedInstruction = JsonCodecContent<\n typeof indexedInstructionJsonCodec\n>;\n\nexport const indexedInstructionJsonCodec = jsonCodecObjectToObject({\n blockTime: jsonCodecNullable(jsonCodecDateTime),\n instructionOrdinal: jsonCodecBigInt,\n instructionName: jsonCodecString,\n instructionAddresses: jsonCodecObjectToRecord(jsonCodecPubkey),\n instructionPayload: jsonCodecValue,\n});\n","import {\n jsonCodecArrayToArray,\n jsonCodecBigInt,\n jsonCodecBoolean,\n JsonCodecContent,\n jsonCodecDateTime,\n jsonCodecNullable,\n jsonCodecNumber,\n jsonCodecObjectToObject,\n jsonCodecPubkey,\n jsonCodecValue,\n} from \"solana-kiss\";\nimport {\n indexedInstructionJsonCodec,\n jsonCodecObjectToMapByPubkey,\n} from \"../utils\";\n\nexport type MiningPoolOnchain = JsonCodecContent<\n typeof miningPoolOnchainJsonCodec\n>;\n\nexport type MiningPoolAnalysis = JsonCodecContent<\n typeof miningPoolAnalysisJsonCodec\n>;\n\nexport const miningPoolOnchainJsonCodec = jsonCodecObjectToObject({\n bump: jsonCodecNumber,\n index: jsonCodecBigInt,\n authority: jsonCodecPubkey,\n collateralMint: jsonCodecPubkey,\n maxDepositCollateralAmount: jsonCodecBigInt,\n totalDepositedCollateralAmount: jsonCodecBigInt,\n totalExtractedCollateralAmount: jsonCodecBigInt,\n claimingEnabled: jsonCodecBoolean,\n redeemableMint: jsonCodecPubkey,\n totalClaimedRedeemableAmount: jsonCodecBigInt,\n freeze: jsonCodecBoolean,\n});\n\nexport const miningPoolAnalysisJsonCodec = jsonCodecObjectToObject({\n latestKnownChangeOrdinal: jsonCodecBigInt,\n latestUpdateFetchOrdinal: jsonCodecBigInt,\n latestOnchainSnapshot: jsonCodecNullable(\n jsonCodecObjectToObject({\n parsed: miningPoolOnchainJsonCodec,\n native: jsonCodecValue,\n updatedAt: jsonCodecDateTime,\n }),\n ),\n depositCollateralAmountPerUser: jsonCodecObjectToMapByPubkey(jsonCodecBigInt),\n claimRedeemableAmountPerUser: jsonCodecObjectToMapByPubkey(jsonCodecBigInt),\n totalDepositCollateralAmount: jsonCodecBigInt,\n totalClaimRedeemableAmount: jsonCodecBigInt,\n totalExtractCollateralAmount: jsonCodecBigInt,\n adminHistory: jsonCodecArrayToArray(indexedInstructionJsonCodec),\n});\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,mCAAAC,EAAA,gCAAAC,EAAA,iCAAAC,EAAA,gCAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAR,GCAA,IAAAS,EAaO,uBCbP,IAAAC,EAeO,uBAEA,SAASC,EACdC,EAC2B,CAC3B,SAAO,wBAAqB,CAC1B,SAAU,CACR,QAAS,mBACT,QAAS,gBACX,EACA,WAAAA,CACF,CAAC,CACH,CAMO,IAAMC,KAA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YAAU,qBAAkB,iBAAe,CAC7C,CAAC,CACH,CAAC,CACH,EACA,oBAAkB,yBAAsB,iBAAe,CACzD,CAAC,EE7HD,IAAAC,EAWO,uBAcA,IAAMC,KAA6B,2BAAwB,CAChE,KAAM,kBACN,MAAO,kBACP,UAAW,kBACX,eAAgB,kBAChB,2BAA4B,kBAC5B,+BAAgC,kBAChC,+BAAgC,kBAChC,gBAAiB,mBACjB,eAAgB,kBAChB,6BAA8B,kBAC9B,OAAQ,kBACV,CAAC,EAEYC,KAA8B,2BAAwB,CACjE,yBAA0B,kBAC1B,yBAA0B,kBAC1B,yBAAuB,wBACrB,2BAAwB,CACtB,OAAQD,EACR,OAAQ,iBACR,UAAW,mBACb,CAAC,CACH,EACA,+BAAgCE,EAA6B,iBAAe,EAC5E,6BAA8BA,EAA6B,iBAAe,EAC1E,6BAA8B,kBAC9B,2BAA4B,kBAC5B,6BAA8B,kBAC9B,gBAAc,yBAAsBC,CAA2B,CACjE,CAAC","names":["index_exports","__export","coordinatorRunAnalysisJsonCodec","coordinatorRunOnchainJsonCodec","indexedInstructionJsonCodec","jsonCodecObjectToMapByPubkey","miningPoolAnalysisJsonCodec","miningPoolOnchainJsonCodec","__toCommonJS","import_solana_kiss","import_solana_kiss","jsonCodecObjectToMapByPubkey","valueCodec","indexedInstructionJsonCodec","coordinatorRunOnchainJsonCodec","coordinatorRunSampleJsonCodec","coordinatorRunAnalysisJsonCodec","jsonCodecObjectToMapByPubkey","name","indexedInstructionJsonCodec","import_solana_kiss","miningPoolOnchainJsonCodec","miningPoolAnalysisJsonCodec","jsonCodecObjectToMapByPubkey","indexedInstructionJsonCodec"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/features/CoordinatorRun.ts","../src/utils.ts","../src/features/MiningPool.ts"],"sourcesContent":["export * from \"./features/CoordinatorRun\";\nexport * from \"./features/MiningPool\";\nexport * from \"./utils\";\n","import {\n jsonCodecArrayToArray,\n jsonCodecArrayToObject,\n jsonCodecBigInt,\n JsonCodecContent,\n jsonCodecDateTime,\n jsonCodecNullable,\n jsonCodecNumber,\n jsonCodecObjectToMap,\n jsonCodecObjectToObject,\n jsonCodecPubkey,\n jsonCodecString,\n jsonCodecValue,\n Pubkey,\n pubkeyFindPdaAddress,\n utf8Encode,\n} from \"solana-kiss\";\nimport {\n indexedInstructionJsonCodec,\n jsonCodecObjectToMapByPubkey,\n} from \"../utils\";\n\nexport function coordinatorRunAddressFromId(\n programAddress: Pubkey,\n runId: string,\n): Pubkey {\n return pubkeyFindPdaAddress(programAddress, [\n utf8Encode(\"coordinator\"),\n utf8Encode(runId).slice(0, 32),\n ]);\n}\n\nexport type CoordinatorRunOnchain = JsonCodecContent<\n typeof coordinatorRunOnchainJsonCodec\n>;\n\nexport type CoordinatorRunSample = JsonCodecContent<\n typeof coordinatorRunSampleJsonCodec\n>;\n\nexport type CoordinatorRunSummary = JsonCodecContent<\n typeof coordinatorRunSummaryJsonCodec\n>;\n\nexport type CoordinatorRunAnalysis = JsonCodecContent<\n typeof coordinatorRunAnalysisJsonCodec\n>;\n\nexport const coordinatorRunOnchainJsonCodec = jsonCodecObjectToObject({\n runId: jsonCodecString,\n mainAuthority: jsonCodecPubkey,\n joinAuthority: jsonCodecPubkey,\n name: jsonCodecString,\n description: jsonCodecString,\n status: jsonCodecString,\n numParameters: jsonCodecBigInt,\n joinedClients: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n signer: jsonCodecPubkey,\n earned: jsonCodecBigInt,\n slashed: jsonCodecBigInt,\n }),\n ),\n epochClients: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n signer: jsonCodecPubkey,\n state: jsonCodecString,\n }),\n ),\n /*\n epochRates: jsonCodecObjectToObject({\n current: jsonCodecObjectToObject({\n earningRate: jsonCodecBigInt,\n slashingRate: jsonCodecBigInt,\n }),\n future: jsonCodecObjectToObject({\n earningRate: jsonCodecBigInt,\n slashingRate: jsonCodecBigInt,\n }),\n }),\n */\n progress: jsonCodecObjectToObject({\n epoch: jsonCodecNumber,\n step: jsonCodecNumber,\n }),\n});\n\nconst coordinatorRunSampleJsonCodec = jsonCodecArrayToObject({\n maxOrdinal: jsonCodecBigInt,\n step: jsonCodecNumber,\n sumValue: jsonCodecNumber,\n numValue: jsonCodecNumber,\n time: jsonCodecNullable(jsonCodecDateTime),\n});\n\nexport const coordinatorRunSummaryJsonCodec = jsonCodecObjectToObject({\n address: jsonCodecPubkey,\n state: coordinatorRunOnchainJsonCodec,\n});\n\nexport const coordinatorRunAnalysisJsonCodec = jsonCodecObjectToObject({\n latestKnownChangeOrdinal: jsonCodecBigInt,\n latestUpdateFetchOrdinal: jsonCodecBigInt,\n latestOnchainSnapshot: jsonCodecNullable(\n jsonCodecObjectToObject({\n parsed: coordinatorRunOnchainJsonCodec,\n native: jsonCodecObjectToObject({\n coordinatorInstance: jsonCodecValue,\n coordinatorAccount: jsonCodecValue,\n }),\n updatedAt: jsonCodecDateTime,\n }),\n ),\n lastWitnessByUser: jsonCodecObjectToMapByPubkey(\n jsonCodecObjectToObject({\n ordinal: jsonCodecBigInt,\n step: jsonCodecNumber,\n }),\n ),\n samplesByStatName: jsonCodecObjectToMap({\n keyCodec: {\n decoder: (name) => name,\n encoder: (name) => name,\n },\n valueCodec: jsonCodecArrayToArray(coordinatorRunSampleJsonCodec),\n }),\n adminHistory: jsonCodecArrayToArray(indexedInstructionJsonCodec),\n joinHistory: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n blockTime: jsonCodecNullable(jsonCodecDateTime),\n instructionOrdinal: jsonCodecBigInt,\n user: jsonCodecPubkey,\n p2pIdentity: jsonCodecPubkey,\n }),\n ),\n checkpointHistory: jsonCodecArrayToArray(\n jsonCodecObjectToObject({\n blockTime: jsonCodecNullable(jsonCodecDateTime),\n instructionOrdinal: jsonCodecBigInt,\n user: jsonCodecPubkey,\n repo: jsonCodecObjectToObject({\n repoId: jsonCodecString,\n revision: jsonCodecNullable(jsonCodecString),\n }),\n }),\n ),\n finishesOrdinals: jsonCodecArrayToArray(jsonCodecBigInt),\n});\n","import {\n JsonCodec,\n JsonCodecContent,\n Pubkey,\n jsonCodecBigInt,\n jsonCodecDateTime,\n jsonCodecNullable,\n jsonCodecObjectToMap,\n jsonCodecObjectToObject,\n jsonCodecObjectToRecord,\n jsonCodecPubkey,\n jsonCodecString,\n jsonCodecValue,\n pubkeyFromBase58,\n pubkeyToBase58,\n} from \"solana-kiss\";\n\nexport function jsonCodecObjectToMapByPubkey<T>(\n valueCodec: JsonCodec<T>,\n): JsonCodec<Map<Pubkey, T>> {\n return jsonCodecObjectToMap({\n keyCodec: {\n decoder: pubkeyFromBase58,\n encoder: pubkeyToBase58,\n },\n valueCodec,\n });\n}\n\nexport type IndexedInstruction = JsonCodecContent<\n typeof indexedInstructionJsonCodec\n>;\n\nexport const indexedInstructionJsonCodec = jsonCodecObjectToObject({\n blockTime: jsonCodecNullable(jsonCodecDateTime),\n instructionOrdinal: jsonCodecBigInt,\n instructionName: jsonCodecString,\n instructionAddresses: jsonCodecObjectToRecord(jsonCodecPubkey),\n instructionPayload: jsonCodecValue,\n});\n","import {\n jsonCodecArrayToArray,\n jsonCodecBigInt,\n jsonCodecBoolean,\n JsonCodecContent,\n jsonCodecDateTime,\n jsonCodecNullable,\n jsonCodecNumber,\n jsonCodecObjectToObject,\n jsonCodecPubkey,\n jsonCodecValue,\n Pubkey,\n pubkeyFindPdaAddress,\n utf8Encode,\n} from \"solana-kiss\";\nimport {\n indexedInstructionJsonCodec,\n jsonCodecObjectToMapByPubkey,\n} from \"../utils\";\n\nexport function miningPoolAddressFromIndex(\n programAddress: Pubkey,\n poolIndex: bigint,\n): Pubkey {\n const poolIndexSeed = new Uint8Array(8);\n new DataView(poolIndexSeed.buffer).setBigUint64(0, poolIndex, true);\n return pubkeyFindPdaAddress(programAddress, [\n utf8Encode(\"Pool\"),\n poolIndexSeed,\n ]);\n}\n\nexport type MiningPoolOnchain = JsonCodecContent<\n typeof miningPoolOnchainJsonCodec\n>;\n\nexport type MiningPoolSummary = JsonCodecContent<\n typeof miningPoolSummaryJsonCodec\n>;\n\nexport type MiningPoolAnalysis = JsonCodecContent<\n typeof miningPoolAnalysisJsonCodec\n>;\n\nexport const miningPoolOnchainJsonCodec = jsonCodecObjectToObject({\n bump: jsonCodecNumber,\n index: jsonCodecBigInt,\n authority: jsonCodecPubkey,\n collateralMint: jsonCodecPubkey,\n maxDepositCollateralAmount: jsonCodecBigInt,\n totalDepositedCollateralAmount: jsonCodecBigInt,\n totalExtractedCollateralAmount: jsonCodecBigInt,\n claimingEnabled: jsonCodecBoolean,\n redeemableMint: jsonCodecPubkey,\n totalClaimedRedeemableAmount: jsonCodecBigInt,\n freeze: jsonCodecBoolean,\n});\n\nexport const miningPoolSummaryJsonCodec = jsonCodecObjectToObject({\n address: jsonCodecPubkey,\n state: miningPoolOnchainJsonCodec,\n});\n\nexport const miningPoolAnalysisJsonCodec = jsonCodecObjectToObject({\n latestKnownChangeOrdinal: jsonCodecBigInt,\n latestUpdateFetchOrdinal: jsonCodecBigInt,\n latestOnchainSnapshot: jsonCodecNullable(\n jsonCodecObjectToObject({\n parsed: miningPoolOnchainJsonCodec,\n native: jsonCodecValue,\n updatedAt: jsonCodecDateTime,\n }),\n ),\n depositCollateralAmountPerUser: jsonCodecObjectToMapByPubkey(jsonCodecBigInt),\n claimRedeemableAmountPerUser: jsonCodecObjectToMapByPubkey(jsonCodecBigInt),\n totalDepositCollateralAmount: jsonCodecBigInt,\n totalClaimRedeemableAmount: jsonCodecBigInt,\n totalExtractCollateralAmount: jsonCodecBigInt,\n adminHistory: jsonCodecArrayToArray(indexedInstructionJsonCodec),\n});\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,EAAA,oCAAAC,EAAA,mCAAAC,EAAA,mCAAAC,EAAA,gCAAAC,EAAA,iCAAAC,EAAA,+BAAAC,EAAA,gCAAAC,EAAA,+BAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAZ,GCAA,IA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["index_exports","__export","coordinatorRunAddressFromId","coordinatorRunAnalysisJsonCodec","coordinatorRunOnchainJsonCodec","coordinatorRunSummaryJsonCodec","indexedInstructionJsonCodec","jsonCodecObjectToMapByPubkey","miningPoolAddressFromIndex","miningPoolAnalysisJsonCodec","miningPoolOnchainJsonCodec","miningPoolSummaryJsonCodec","__toCommonJS","import_solana_kiss","import_solana_kiss","jsonCodecObjectToMapByPubkey","valueCodec","indexedInstructionJsonCodec","coordinatorRunAddressFromId","programAddress","runId","coordinatorRunOnchainJsonCodec","coordinatorRunSampleJsonCodec","coordinatorRunSummaryJsonCodec","coordinatorRunAnalysisJsonCodec","jsonCodecObjectToMapByPubkey","name","indexedInstructionJsonCodec","import_solana_kiss","miningPoolAddressFromIndex","programAddress","poolIndex","poolIndexSeed","miningPoolOnchainJsonCodec","miningPoolSummaryJsonCodec","miningPoolAnalysisJsonCodec","jsonCodecObjectToMapByPubkey","indexedInstructionJsonCodec"]}
|
package/package.json
CHANGED
|
@@ -11,12 +11,25 @@ import {
|
|
|
11
11
|
jsonCodecPubkey,
|
|
12
12
|
jsonCodecString,
|
|
13
13
|
jsonCodecValue,
|
|
14
|
+
Pubkey,
|
|
15
|
+
pubkeyFindPdaAddress,
|
|
16
|
+
utf8Encode,
|
|
14
17
|
} from "solana-kiss";
|
|
15
18
|
import {
|
|
16
19
|
indexedInstructionJsonCodec,
|
|
17
20
|
jsonCodecObjectToMapByPubkey,
|
|
18
21
|
} from "../utils";
|
|
19
22
|
|
|
23
|
+
export function coordinatorRunAddressFromId(
|
|
24
|
+
programAddress: Pubkey,
|
|
25
|
+
runId: string,
|
|
26
|
+
): Pubkey {
|
|
27
|
+
return pubkeyFindPdaAddress(programAddress, [
|
|
28
|
+
utf8Encode("coordinator"),
|
|
29
|
+
utf8Encode(runId).slice(0, 32),
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
|
|
20
33
|
export type CoordinatorRunOnchain = JsonCodecContent<
|
|
21
34
|
typeof coordinatorRunOnchainJsonCodec
|
|
22
35
|
>;
|
|
@@ -25,6 +38,10 @@ export type CoordinatorRunSample = JsonCodecContent<
|
|
|
25
38
|
typeof coordinatorRunSampleJsonCodec
|
|
26
39
|
>;
|
|
27
40
|
|
|
41
|
+
export type CoordinatorRunSummary = JsonCodecContent<
|
|
42
|
+
typeof coordinatorRunSummaryJsonCodec
|
|
43
|
+
>;
|
|
44
|
+
|
|
28
45
|
export type CoordinatorRunAnalysis = JsonCodecContent<
|
|
29
46
|
typeof coordinatorRunAnalysisJsonCodec
|
|
30
47
|
>;
|
|
@@ -76,6 +93,11 @@ const coordinatorRunSampleJsonCodec = jsonCodecArrayToObject({
|
|
|
76
93
|
time: jsonCodecNullable(jsonCodecDateTime),
|
|
77
94
|
});
|
|
78
95
|
|
|
96
|
+
export const coordinatorRunSummaryJsonCodec = jsonCodecObjectToObject({
|
|
97
|
+
address: jsonCodecPubkey,
|
|
98
|
+
state: coordinatorRunOnchainJsonCodec,
|
|
99
|
+
});
|
|
100
|
+
|
|
79
101
|
export const coordinatorRunAnalysisJsonCodec = jsonCodecObjectToObject({
|
|
80
102
|
latestKnownChangeOrdinal: jsonCodecBigInt,
|
|
81
103
|
latestUpdateFetchOrdinal: jsonCodecBigInt,
|
|
@@ -9,16 +9,35 @@ import {
|
|
|
9
9
|
jsonCodecObjectToObject,
|
|
10
10
|
jsonCodecPubkey,
|
|
11
11
|
jsonCodecValue,
|
|
12
|
+
Pubkey,
|
|
13
|
+
pubkeyFindPdaAddress,
|
|
14
|
+
utf8Encode,
|
|
12
15
|
} from "solana-kiss";
|
|
13
16
|
import {
|
|
14
17
|
indexedInstructionJsonCodec,
|
|
15
18
|
jsonCodecObjectToMapByPubkey,
|
|
16
19
|
} from "../utils";
|
|
17
20
|
|
|
21
|
+
export function miningPoolAddressFromIndex(
|
|
22
|
+
programAddress: Pubkey,
|
|
23
|
+
poolIndex: bigint,
|
|
24
|
+
): Pubkey {
|
|
25
|
+
const poolIndexSeed = new Uint8Array(8);
|
|
26
|
+
new DataView(poolIndexSeed.buffer).setBigUint64(0, poolIndex, true);
|
|
27
|
+
return pubkeyFindPdaAddress(programAddress, [
|
|
28
|
+
utf8Encode("Pool"),
|
|
29
|
+
poolIndexSeed,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
export type MiningPoolOnchain = JsonCodecContent<
|
|
19
34
|
typeof miningPoolOnchainJsonCodec
|
|
20
35
|
>;
|
|
21
36
|
|
|
37
|
+
export type MiningPoolSummary = JsonCodecContent<
|
|
38
|
+
typeof miningPoolSummaryJsonCodec
|
|
39
|
+
>;
|
|
40
|
+
|
|
22
41
|
export type MiningPoolAnalysis = JsonCodecContent<
|
|
23
42
|
typeof miningPoolAnalysisJsonCodec
|
|
24
43
|
>;
|
|
@@ -37,6 +56,11 @@ export const miningPoolOnchainJsonCodec = jsonCodecObjectToObject({
|
|
|
37
56
|
freeze: jsonCodecBoolean,
|
|
38
57
|
});
|
|
39
58
|
|
|
59
|
+
export const miningPoolSummaryJsonCodec = jsonCodecObjectToObject({
|
|
60
|
+
address: jsonCodecPubkey,
|
|
61
|
+
state: miningPoolOnchainJsonCodec,
|
|
62
|
+
});
|
|
63
|
+
|
|
40
64
|
export const miningPoolAnalysisJsonCodec = jsonCodecObjectToObject({
|
|
41
65
|
latestKnownChangeOrdinal: jsonCodecBigInt,
|
|
42
66
|
latestUpdateFetchOrdinal: jsonCodecBigInt,
|