chore: apply prettier
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
export default {
|
||||
transform: { "^.+\\.tsx?$": "babel-jest" },
|
||||
transformIgnorePatterns: ["/node_modules/(?!@babel/runtime)"],
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
testEnvironment: "node",
|
||||
};
|
||||
|
||||
transform: { "^.+\\.tsx?$": "babel-jest" },
|
||||
transformIgnorePatterns: ["/node_modules/(?!@babel/runtime)"],
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
testEnvironment: "node",
|
||||
};
|
||||
|
@ -21,7 +21,6 @@ export async function task(roundNumber: number): Promise<void> {
|
||||
// FORCE TO PAUSE 30 SECONDS
|
||||
// No submission on Round 0 so no need to trigger fetch audit result before round 3
|
||||
// Changed from 3 to 4 to have more time
|
||||
|
||||
// if (roundNumber >= 4) {
|
||||
// const auditRound = roundNumber - 4;
|
||||
// const response = await fetch(`${middleServerUrl}/summarizer/worker/update-audit-result`, {
|
||||
|
@ -24,7 +24,7 @@ export async function submission(roundNumber: number): Promise<string | void> {
|
||||
* The default implementation handles uploading the proofs to IPFS
|
||||
* and returning the CID
|
||||
*/
|
||||
if(!await preRunCheck(roundNumber.toString())){
|
||||
if (!(await preRunCheck(roundNumber.toString()))) {
|
||||
return;
|
||||
}
|
||||
const stakingKeypair = await namespaceWrapper.getSubmitterAccount();
|
||||
@ -51,7 +51,7 @@ export async function submission(roundNumber: number): Promise<string | void> {
|
||||
roundNumber,
|
||||
stakingKey,
|
||||
publicKey: pubKey,
|
||||
secretKey
|
||||
secretKey,
|
||||
});
|
||||
|
||||
return cid || void 0;
|
||||
@ -94,16 +94,19 @@ async function makeSubmission(params: SubmissionParams): Promise<string | void>
|
||||
prUrl: submissionData.prUrl,
|
||||
stakingKey,
|
||||
publicKey,
|
||||
secretKey
|
||||
secretKey,
|
||||
});
|
||||
|
||||
const signature = await signSubmissionPayload({
|
||||
taskId: TASK_ID,
|
||||
roundNumber,
|
||||
stakingKey,
|
||||
pubKey: publicKey,
|
||||
...submissionData
|
||||
}, secretKey);
|
||||
const signature = await signSubmissionPayload(
|
||||
{
|
||||
taskId: TASK_ID,
|
||||
roundNumber,
|
||||
stakingKey,
|
||||
pubKey: publicKey,
|
||||
...submissionData,
|
||||
},
|
||||
secretKey,
|
||||
);
|
||||
|
||||
const cid = await storeSubmissionOnIPFS(signature);
|
||||
await cleanupSubmissionState();
|
||||
@ -120,9 +123,7 @@ async function fetchSubmissionData(orcaClient: any, swarmBountyId: string): Prom
|
||||
return null;
|
||||
}
|
||||
|
||||
const submission = typeof result.data === 'object' && 'data' in result.data
|
||||
? result.data.data
|
||||
: result.data;
|
||||
const submission = typeof result.data === "object" && "data" in result.data ? result.data.data : result.data;
|
||||
|
||||
if (!submission?.prUrl) {
|
||||
throw new Error("Submission is missing PR URL");
|
||||
|
@ -14,7 +14,6 @@ import { middleServerUrl, status } from "../utils/constant";
|
||||
|
||||
//Example route
|
||||
export async function routes() {
|
||||
|
||||
app.get("/value", async (_req, res) => {
|
||||
const value = await namespaceWrapper.storeGet("value");
|
||||
console.log("value", value);
|
||||
@ -64,7 +63,7 @@ export async function routes() {
|
||||
const message = req.body.message;
|
||||
console.log("[TASK] req.body", req.body);
|
||||
try {
|
||||
if (!success){
|
||||
if (!success) {
|
||||
console.error("[TASK] Error summarizing repository:", message);
|
||||
return;
|
||||
}
|
||||
@ -128,7 +127,6 @@ export async function routes() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// TODO: To be completed
|
||||
app.post("/failed-task", async (req, res) => {
|
||||
res.status(200).json({ result: "Successfully saved task result" });
|
||||
|
@ -1,36 +1,35 @@
|
||||
export function isValidAnthropicApiKey(key: string) {
|
||||
const regex = /^sk-ant-[a-zA-Z0-9_-]{32,}$/;
|
||||
return regex.test(key);
|
||||
const regex = /^sk-ant-[a-zA-Z0-9_-]{32,}$/;
|
||||
return regex.test(key);
|
||||
}
|
||||
|
||||
export async function checkAnthropicAPIKey(apiKey: string) {
|
||||
const response = await fetch('https://api.anthropic.com/v1/messages', {
|
||||
method: 'POST',
|
||||
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'x-api-key': apiKey,
|
||||
'anthropic-version': '2023-06-01',
|
||||
'content-type': 'application/json',
|
||||
"x-api-key": apiKey,
|
||||
"anthropic-version": "2023-06-01",
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: 'claude-3-opus-20240229', // or a cheaper model
|
||||
model: "claude-3-opus-20240229", // or a cheaper model
|
||||
max_tokens: 1, // minimal usage
|
||||
messages: [{ role: 'user', content: 'Hi' }],
|
||||
messages: [{ role: "user", content: "Hi" }],
|
||||
}),
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
console.log('✅ API key is valid and has credit.');
|
||||
console.log("✅ API key is valid and has credit.");
|
||||
return true;
|
||||
} else {
|
||||
const data = await response.json().catch(() => ({}));
|
||||
if (response.status === 401) {
|
||||
console.log('❌ Invalid API key.');
|
||||
} else if (response.status === 403 && data.error?.message?.includes('billing')) {
|
||||
console.log('❌ API key has no credit or is not authorized.');
|
||||
console.log("❌ Invalid API key.");
|
||||
} else if (response.status === 403 && data.error?.message?.includes("billing")) {
|
||||
console.log("❌ API key has no credit or is not authorized.");
|
||||
} else {
|
||||
console.log('⚠️ Unexpected error:', data);
|
||||
console.log("⚠️ Unexpected error:", data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@ import { LogLevel } from "@_koii/namespace-wrapper/dist/types";
|
||||
import { errorMessage, actionMessage, status } from "../constant";
|
||||
import { checkAnthropicAPIKey } from "./anthropicCheck";
|
||||
import { checkGitHub } from "./githubCheck";
|
||||
export async function preRunCheck(roundNumber:string){
|
||||
if (!process.env.ANTHROPIC_API_KEY) {
|
||||
export async function preRunCheck(roundNumber: string) {
|
||||
if (!process.env.ANTHROPIC_API_KEY) {
|
||||
await namespaceWrapper.logMessage(
|
||||
LogLevel.Error,
|
||||
errorMessage.ANTHROPIC_API_KEY_INVALID,
|
||||
|
@ -1,36 +1,36 @@
|
||||
export async function checkGitHub(username: string, token: string) {
|
||||
// 1. Check username
|
||||
const userRes = await fetch(`https://api.github.com/users/${username}`);
|
||||
const isUsernameValid = userRes.status === 200;
|
||||
// 1. Check username
|
||||
const userRes = await fetch(`https://api.github.com/users/${username}`);
|
||||
const isUsernameValid = userRes.status === 200;
|
||||
|
||||
// 2. Check token
|
||||
const tokenRes = await fetch('https://api.github.com/user', {
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
},
|
||||
});
|
||||
const isTokenValid = tokenRes.status === 200;
|
||||
const isIdentityValid = await checkGitHubIdentity(username, token);
|
||||
return isIdentityValid&&isUsernameValid&&isTokenValid
|
||||
// 2. Check token
|
||||
const tokenRes = await fetch("https://api.github.com/user", {
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
},
|
||||
});
|
||||
const isTokenValid = tokenRes.status === 200;
|
||||
const isIdentityValid = await checkGitHubIdentity(username, token);
|
||||
return isIdentityValid && isUsernameValid && isTokenValid;
|
||||
}
|
||||
|
||||
async function checkGitHubIdentity(username: string, token: string) {
|
||||
const res = await fetch('https://api.github.com/user', {
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
},
|
||||
});
|
||||
const res = await fetch("https://api.github.com/user", {
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
Accept: "application/vnd.github.v3+json",
|
||||
},
|
||||
});
|
||||
|
||||
if (res.status !== 200) {
|
||||
return false
|
||||
}
|
||||
if (res.status !== 200) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
const data = await res.json();
|
||||
|
||||
if (data.login.toLowerCase() !== username.toLowerCase()) {
|
||||
return false
|
||||
}
|
||||
if (data.login.toLowerCase() !== username.toLowerCase()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true
|
||||
return true;
|
||||
}
|
@ -12,90 +12,90 @@ interface BountyIssue {
|
||||
}
|
||||
|
||||
export async function getExistingIssues(): Promise<BountyIssue[]> {
|
||||
try {
|
||||
// read from the bounty markdown file
|
||||
try {
|
||||
// read from the bounty markdown file
|
||||
// console.log('Fetching markdown file from:', defaultBountyMarkdownFile);
|
||||
const bountyMarkdownFile = await fetch(defaultBountyMarkdownFile);
|
||||
const bountyMarkdownFileText = await bountyMarkdownFile.text();
|
||||
const bountyMarkdownFile = await fetch(defaultBountyMarkdownFile);
|
||||
const bountyMarkdownFileText = await bountyMarkdownFile.text();
|
||||
|
||||
// console.log('Raw markdown content:', bountyMarkdownFileText);
|
||||
|
||||
const bountyMarkdownFileLines = bountyMarkdownFileText.split("\n");
|
||||
const bountyMarkdownFileLines = bountyMarkdownFileText.split("\n");
|
||||
// console.log('Number of lines:', bountyMarkdownFileLines.length);
|
||||
|
||||
const issues: BountyIssue[] = [];
|
||||
let isTableStarted = false;
|
||||
const issues: BountyIssue[] = [];
|
||||
let isTableStarted = false;
|
||||
|
||||
for (const line of bountyMarkdownFileLines) {
|
||||
// Skip empty lines
|
||||
if (line.trim() === '') {
|
||||
for (const line of bountyMarkdownFileLines) {
|
||||
// Skip empty lines
|
||||
if (line.trim() === "") {
|
||||
// console.log('Skipping empty line');
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// console.log('Processing line:', line);
|
||||
|
||||
// Skip the title line starting with #
|
||||
if (line.startsWith('#')) {
|
||||
// Skip the title line starting with #
|
||||
if (line.startsWith("#")) {
|
||||
// console.log('Found title line:', line);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip the header and separator lines
|
||||
if (line.startsWith('|') && line.includes('GitHub URL')) {
|
||||
//console.log('Found header line');
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith('|') && line.includes('-----')) {
|
||||
// Skip the header and separator lines
|
||||
if (line.startsWith("|") && line.includes("GitHub URL")) {
|
||||
//console.log('Found header line');
|
||||
continue;
|
||||
}
|
||||
if (line.startsWith("|") && line.includes("-----")) {
|
||||
// console.log('Found separator line');
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process table rows
|
||||
if (line.startsWith('|')) {
|
||||
isTableStarted = true;
|
||||
// Remove first and last | and split by |
|
||||
const cells = line.slice(1, -1).split('|').map(cell => cell.trim());
|
||||
// Process table rows
|
||||
if (line.startsWith("|")) {
|
||||
isTableStarted = true;
|
||||
// Remove first and last | and split by |
|
||||
const cells = line
|
||||
.slice(1, -1)
|
||||
.split("|")
|
||||
.map((cell) => cell.trim());
|
||||
// console.log('Parsed cells:', cells);
|
||||
|
||||
// Extract GitHub URL and name from markdown link format [name](url)
|
||||
const githubUrlMatch = cells[0].match(/\[(.*?)\]\((.*?)\)/);
|
||||
// Extract GitHub URL and name from markdown link format [name](url)
|
||||
const githubUrlMatch = cells[0].match(/\[(.*?)\]\((.*?)\)/);
|
||||
// console.log('GitHub URL match:', githubUrlMatch);
|
||||
|
||||
const projectName = githubUrlMatch ? githubUrlMatch[1] : '';
|
||||
const githubUrl = githubUrlMatch ? githubUrlMatch[2] : '';
|
||||
const projectName = githubUrlMatch ? githubUrlMatch[1] : "";
|
||||
const githubUrl = githubUrlMatch ? githubUrlMatch[2] : "";
|
||||
|
||||
const issue: BountyIssue = {
|
||||
githubUrl,
|
||||
projectName,
|
||||
bountyTask: cells[1],
|
||||
description: cells[3],
|
||||
bountyAmount: cells[4],
|
||||
bountyType: cells[5],
|
||||
transactionHash: cells[6],
|
||||
status: cells[7]
|
||||
};
|
||||
const issue: BountyIssue = {
|
||||
githubUrl,
|
||||
projectName,
|
||||
bountyTask: cells[1],
|
||||
description: cells[3],
|
||||
bountyAmount: cells[4],
|
||||
bountyType: cells[5],
|
||||
transactionHash: cells[6],
|
||||
status: cells[7],
|
||||
};
|
||||
|
||||
// console.log('Created issue object:', issue);
|
||||
issues.push(issue);
|
||||
}
|
||||
}
|
||||
// Filter all issues with status "Initialized" && Bounty Task is Document & Summarize
|
||||
console.log('Final parsed issues number:', issues.length);
|
||||
return issues
|
||||
} catch (error) {
|
||||
issues.push(issue);
|
||||
}
|
||||
}
|
||||
// Filter all issues with status "Initialized" && Bounty Task is Document & Summarize
|
||||
console.log("Final parsed issues number:", issues.length);
|
||||
return issues;
|
||||
} catch (error) {
|
||||
// console.error('Error processing markdown:', error);
|
||||
throw error;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function getInitializedDocumentSummarizeIssues(issues: BountyIssue[]) {
|
||||
|
||||
return issues.filter(issue => issue.status === "Initialized" && issue.bountyTask === "Document & Summarize");
|
||||
return issues.filter((issue) => issue.status === "Initialized" && issue.bountyTask === "Document & Summarize");
|
||||
}
|
||||
|
||||
|
||||
// async function main(){
|
||||
// const existingIssues = await getExistingIssues();
|
||||
// const transactionHashs = [
|
||||
|
@ -3,38 +3,45 @@ import { getFile } from "./ipfs";
|
||||
import { Submission } from "@_koii/namespace-wrapper/dist/types";
|
||||
import { Submitter } from "@_koii/task-manager/dist/types/global";
|
||||
import { namespaceWrapper } from "@_koii/namespace-wrapper";
|
||||
export async function submissionJSONSignatureDecode({submission_value, submitterPublicKey, roundNumber}: {submission_value: string, submitterPublicKey: string, roundNumber: number}) {
|
||||
let submissionString;
|
||||
try {
|
||||
console.log("Getting file from IPFS", submission_value);
|
||||
submissionString = await getFile(submission_value);
|
||||
console.log("submissionString", submissionString);
|
||||
} catch (error) {
|
||||
|
||||
console.log("error", error);
|
||||
console.error("INVALID SIGNATURE DATA");
|
||||
return null;
|
||||
}
|
||||
// verify the signature of the submission
|
||||
const submission = JSON.parse(submissionString);
|
||||
console.log("submission", submission);
|
||||
const signaturePayload = await namespaceWrapper.verifySignature(submission.signature, submitterPublicKey);
|
||||
if (!signaturePayload.data) {
|
||||
console.error("INVALID SIGNATURE");
|
||||
return null;
|
||||
}
|
||||
const data = JSON.parse(signaturePayload.data);
|
||||
console.log("signaturePayload", signaturePayload);
|
||||
console.log("data", data);
|
||||
if (
|
||||
data.taskId !== TASK_ID ||
|
||||
data.roundNumber !== roundNumber ||
|
||||
data.stakingKey !== submitterPublicKey ||
|
||||
!data.pubKey ||
|
||||
!data.prUrl
|
||||
) {
|
||||
console.error("INVALID SIGNATURE DATA");
|
||||
return null;
|
||||
}
|
||||
return data;
|
||||
export async function submissionJSONSignatureDecode({
|
||||
submission_value,
|
||||
submitterPublicKey,
|
||||
roundNumber,
|
||||
}: {
|
||||
submission_value: string;
|
||||
submitterPublicKey: string;
|
||||
roundNumber: number;
|
||||
}) {
|
||||
let submissionString;
|
||||
try {
|
||||
console.log("Getting file from IPFS", submission_value);
|
||||
submissionString = await getFile(submission_value);
|
||||
console.log("submissionString", submissionString);
|
||||
} catch (error) {
|
||||
console.log("error", error);
|
||||
console.error("INVALID SIGNATURE DATA");
|
||||
return null;
|
||||
}
|
||||
// verify the signature of the submission
|
||||
const submission = JSON.parse(submissionString);
|
||||
console.log("submission", submission);
|
||||
const signaturePayload = await namespaceWrapper.verifySignature(submission.signature, submitterPublicKey);
|
||||
if (!signaturePayload.data) {
|
||||
console.error("INVALID SIGNATURE");
|
||||
return null;
|
||||
}
|
||||
const data = JSON.parse(signaturePayload.data);
|
||||
console.log("signaturePayload", signaturePayload);
|
||||
console.log("data", data);
|
||||
if (
|
||||
data.taskId !== TASK_ID ||
|
||||
data.roundNumber !== roundNumber ||
|
||||
data.stakingKey !== submitterPublicKey ||
|
||||
!data.pubKey ||
|
||||
!data.prUrl
|
||||
) {
|
||||
console.error("INVALID SIGNATURE DATA");
|
||||
return null;
|
||||
}
|
||||
return data;
|
||||
}
|
@ -5,105 +5,107 @@ import { actionMessage, errorMessage, middleServerUrl } from "../constant";
|
||||
|
||||
import { TASK_ID, namespaceWrapper } from "@_koii/namespace-wrapper";
|
||||
import { LogLevel } from "@_koii/namespace-wrapper/dist/types";
|
||||
export async function task(){
|
||||
while (true) {
|
||||
try {
|
||||
let requiredWorkResponse;
|
||||
const orcaClient = await getOrcaClient();
|
||||
// check if the env variable is valid
|
||||
const stakingKeypair = await namespaceWrapper.getSubmitterAccount()!;
|
||||
const pubKey = await namespaceWrapper.getMainAccountPubkey();
|
||||
if (!orcaClient || !stakingKeypair || !pubKey) {
|
||||
await namespaceWrapper.logMessage(LogLevel.Error, errorMessage.NO_ORCA_CLIENT, actionMessage.NO_ORCA_CLIENT);
|
||||
// Wait for 1 minute before retrying
|
||||
await new Promise(resolve => setTimeout(resolve, 60000));
|
||||
continue;
|
||||
}
|
||||
const stakingKey = stakingKeypair.publicKey.toBase58();
|
||||
export async function task() {
|
||||
while (true) {
|
||||
try {
|
||||
let requiredWorkResponse;
|
||||
const orcaClient = await getOrcaClient();
|
||||
// check if the env variable is valid
|
||||
const stakingKeypair = await namespaceWrapper.getSubmitterAccount()!;
|
||||
const pubKey = await namespaceWrapper.getMainAccountPubkey();
|
||||
if (!orcaClient || !stakingKeypair || !pubKey) {
|
||||
await namespaceWrapper.logMessage(LogLevel.Error, errorMessage.NO_ORCA_CLIENT, actionMessage.NO_ORCA_CLIENT);
|
||||
// Wait for 1 minute before retrying
|
||||
await new Promise((resolve) => setTimeout(resolve, 60000));
|
||||
continue;
|
||||
}
|
||||
const stakingKey = stakingKeypair.publicKey.toBase58();
|
||||
|
||||
/****************** All these issues need to be generate a markdown file ******************/
|
||||
/****************** All these issues need to be generate a markdown file ******************/
|
||||
|
||||
const signature = await namespaceWrapper.payloadSigning(
|
||||
{
|
||||
taskId: TASK_ID,
|
||||
// roundNumber: roundNumber,
|
||||
action: "fetch-todo",
|
||||
githubUsername: stakingKey,
|
||||
stakingKey: stakingKey,
|
||||
},
|
||||
stakingKeypair.secretKey,
|
||||
);
|
||||
const signature = await namespaceWrapper.payloadSigning(
|
||||
{
|
||||
taskId: TASK_ID,
|
||||
// roundNumber: roundNumber,
|
||||
action: "fetch-todo",
|
||||
githubUsername: stakingKey,
|
||||
stakingKey: stakingKey,
|
||||
},
|
||||
stakingKeypair.secretKey,
|
||||
);
|
||||
|
||||
const retryDelay = 10000; // 10 seconds in milliseconds
|
||||
const retryDelay = 10000; // 10 seconds in milliseconds
|
||||
|
||||
while (true) {
|
||||
requiredWorkResponse = await fetch(`${middleServerUrl}/summarizer/worker/fetch-todo`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ signature: signature, stakingKey: stakingKey }),
|
||||
});
|
||||
while (true) {
|
||||
requiredWorkResponse = await fetch(`${middleServerUrl}/summarizer/worker/fetch-todo`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ signature: signature, stakingKey: stakingKey }),
|
||||
});
|
||||
|
||||
if (requiredWorkResponse.status === 200) {
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(`[TASK] Server returned status ${requiredWorkResponse.status}, retrying in ${retryDelay/1000} seconds...`);
|
||||
await new Promise(resolve => setTimeout(resolve, retryDelay));
|
||||
}
|
||||
|
||||
// check if the response is 200 after all retries
|
||||
if (!requiredWorkResponse || requiredWorkResponse.status !== 200) {
|
||||
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.NO_ISSUES_PENDING_TO_BE_SUMMARIZED);
|
||||
return;
|
||||
}
|
||||
const requiredWorkResponseData = await requiredWorkResponse.json();
|
||||
console.log("[TASK] requiredWorkResponseData: ", requiredWorkResponseData);
|
||||
// const uuid = uuidv4();
|
||||
const alreadyAssigned = await namespaceWrapper.storeGet(JSON.stringify(requiredWorkResponseData.data.id));
|
||||
if (alreadyAssigned) {
|
||||
return;
|
||||
}else{
|
||||
await namespaceWrapper.storeSet(JSON.stringify(requiredWorkResponseData.data.id), "initialized");
|
||||
}
|
||||
|
||||
const podcallPayload = {
|
||||
taskId: TASK_ID,
|
||||
};
|
||||
|
||||
const podCallSignature = await namespaceWrapper.payloadSigning(podcallPayload, stakingKeypair.secretKey);
|
||||
|
||||
const jsonBody = {
|
||||
task_id: TASK_ID,
|
||||
swarmBountyId: requiredWorkResponseData.data.id,
|
||||
repo_url: `https://github.com/${requiredWorkResponseData.data.repo_owner}/${requiredWorkResponseData.data.repo_name}`,
|
||||
podcall_signature: podCallSignature,
|
||||
};
|
||||
console.log("[TASK] jsonBody: ", jsonBody);
|
||||
try {
|
||||
const repoSummaryResponse = await orcaClient.podCall(`worker-task`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(jsonBody),
|
||||
});
|
||||
console.log("[TASK] repoSummaryResponse: ", repoSummaryResponse);
|
||||
if (repoSummaryResponse.status !== 200) {
|
||||
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
|
||||
}
|
||||
} catch (error) {
|
||||
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
|
||||
console.error("[TASK] EXECUTE TASK ERROR:", error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[TASK] EXECUTE TASK ERROR:", error);
|
||||
// Wait for 1 minute before retrying on error
|
||||
await new Promise(resolve => setTimeout(resolve, 60000));
|
||||
if (requiredWorkResponse.status === 200) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Wait for 1 minute before starting the next iteration
|
||||
await new Promise(resolve => setTimeout(resolve, 60000));
|
||||
console.log(
|
||||
`[TASK] Server returned status ${requiredWorkResponse.status}, retrying in ${retryDelay / 1000} seconds...`,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
||||
}
|
||||
|
||||
// check if the response is 200 after all retries
|
||||
if (!requiredWorkResponse || requiredWorkResponse.status !== 200) {
|
||||
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.NO_ISSUES_PENDING_TO_BE_SUMMARIZED);
|
||||
return;
|
||||
}
|
||||
const requiredWorkResponseData = await requiredWorkResponse.json();
|
||||
console.log("[TASK] requiredWorkResponseData: ", requiredWorkResponseData);
|
||||
// const uuid = uuidv4();
|
||||
const alreadyAssigned = await namespaceWrapper.storeGet(JSON.stringify(requiredWorkResponseData.data.id));
|
||||
if (alreadyAssigned) {
|
||||
return;
|
||||
} else {
|
||||
await namespaceWrapper.storeSet(JSON.stringify(requiredWorkResponseData.data.id), "initialized");
|
||||
}
|
||||
|
||||
const podcallPayload = {
|
||||
taskId: TASK_ID,
|
||||
};
|
||||
|
||||
const podCallSignature = await namespaceWrapper.payloadSigning(podcallPayload, stakingKeypair.secretKey);
|
||||
|
||||
const jsonBody = {
|
||||
task_id: TASK_ID,
|
||||
swarmBountyId: requiredWorkResponseData.data.id,
|
||||
repo_url: `https://github.com/${requiredWorkResponseData.data.repo_owner}/${requiredWorkResponseData.data.repo_name}`,
|
||||
podcall_signature: podCallSignature,
|
||||
};
|
||||
console.log("[TASK] jsonBody: ", jsonBody);
|
||||
try {
|
||||
const repoSummaryResponse = await orcaClient.podCall(`worker-task`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(jsonBody),
|
||||
});
|
||||
console.log("[TASK] repoSummaryResponse: ", repoSummaryResponse);
|
||||
if (repoSummaryResponse.status !== 200) {
|
||||
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
|
||||
}
|
||||
} catch (error) {
|
||||
// await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED);
|
||||
console.error("[TASK] EXECUTE TASK ERROR:", error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[TASK] EXECUTE TASK ERROR:", error);
|
||||
// Wait for 1 minute before retrying on error
|
||||
await new Promise((resolve) => setTimeout(resolve, 60000));
|
||||
}
|
||||
|
||||
// Wait for 1 minute before starting the next iteration
|
||||
await new Promise((resolve) => setTimeout(resolve, 60000));
|
||||
}
|
||||
}
|
@ -19,11 +19,13 @@ tests/
|
||||
## Prerequisites
|
||||
|
||||
1. Install the test framework:
|
||||
|
||||
```bash
|
||||
pip install -e test-framework/
|
||||
```
|
||||
|
||||
2. Set up environment variables in `.env`:
|
||||
|
||||
```
|
||||
ANTHROPIC_API_KEY=your_test_key
|
||||
GITHUB_USERNAME=your_test_username
|
||||
@ -47,12 +49,15 @@ python -m tests.e2e --reset
|
||||
## Test Flow
|
||||
|
||||
1. API Key Validation
|
||||
|
||||
- Validates Anthropic API key
|
||||
|
||||
2. GitHub Validation
|
||||
|
||||
- Validates GitHub credentials
|
||||
|
||||
3. Todo Management
|
||||
|
||||
- Fetches todos for each worker
|
||||
- Generates summaries
|
||||
- Submits results
|
||||
|
@ -1,12 +1,8 @@
|
||||
import "dotenv/config";
|
||||
|
||||
export const TASK_ID =
|
||||
process.env.TASK_ID || "BXbYKFdXZhQgEaMFbeShaisQBYG1FD4MiSf9gg4n6mVn";
|
||||
export const WEBPACKED_FILE_PATH =
|
||||
process.env.WEBPACKED_FILE_PATH || "../dist/main.js";
|
||||
export const TASK_ID = process.env.TASK_ID || "BXbYKFdXZhQgEaMFbeShaisQBYG1FD4MiSf9gg4n6mVn";
|
||||
export const WEBPACKED_FILE_PATH = process.env.WEBPACKED_FILE_PATH || "../dist/main.js";
|
||||
|
||||
const envKeywords = process.env.TEST_KEYWORDS ?? "";
|
||||
|
||||
export const TEST_KEYWORDS = envKeywords
|
||||
? envKeywords.split(",")
|
||||
: ["TEST", "EZ TESTING"];
|
||||
export const TEST_KEYWORDS = envKeywords ? envKeywords.split(",") : ["TEST", "EZ TESTING"];
|
||||
|
File diff suppressed because it is too large
Load Diff
364
worker/tests/wasm/bincode_js.d.ts
vendored
364
worker/tests/wasm/bincode_js.d.ts
vendored
@ -1,225 +1,225 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* @param {any} val
|
||||
* @returns {any}
|
||||
*/
|
||||
* @param {any} val
|
||||
* @returns {any}
|
||||
*/
|
||||
export function bincode_js_deserialize(val: any): any;
|
||||
/**
|
||||
* @param {any} val
|
||||
* @returns {any}
|
||||
*/
|
||||
* @param {any} val
|
||||
* @returns {any}
|
||||
*/
|
||||
export function borsh_bpf_js_deserialize(val: any): any;
|
||||
/**
|
||||
* Initialize Javascript logging and panic handler
|
||||
*/
|
||||
* Initialize Javascript logging and panic handler
|
||||
*/
|
||||
export function solana_program_init(): void;
|
||||
/**
|
||||
* A hash; the 32-byte output of a hashing algorithm.
|
||||
*
|
||||
* This struct is used most often in `solana-sdk` and related crates to contain
|
||||
* a [SHA-256] hash, but may instead contain a [blake3] hash, as created by the
|
||||
* [`blake3`] module (and used in [`Message::hash`]).
|
||||
*
|
||||
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
|
||||
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
|
||||
* [`blake3`]: crate::blake3
|
||||
* [`Message::hash`]: crate::message::Message::hash
|
||||
*/
|
||||
* A hash; the 32-byte output of a hashing algorithm.
|
||||
*
|
||||
* This struct is used most often in `solana-sdk` and related crates to contain
|
||||
* a [SHA-256] hash, but may instead contain a [blake3] hash, as created by the
|
||||
* [`blake3`] module (and used in [`Message::hash`]).
|
||||
*
|
||||
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
|
||||
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
|
||||
* [`blake3`]: crate::blake3
|
||||
* [`Message::hash`]: crate::message::Message::hash
|
||||
*/
|
||||
export class Hash {
|
||||
free(): void;
|
||||
/**
|
||||
* Create a new Hash object
|
||||
*
|
||||
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
|
||||
* @param {any} value
|
||||
*/
|
||||
/**
|
||||
* Create a new Hash object
|
||||
*
|
||||
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
|
||||
* @param {any} value
|
||||
*/
|
||||
constructor(value: any);
|
||||
/**
|
||||
* Return the base58 string representation of the hash
|
||||
* @returns {string}
|
||||
*/
|
||||
/**
|
||||
* Return the base58 string representation of the hash
|
||||
* @returns {string}
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Checks if two `Hash`s are equal
|
||||
* @param {Hash} other
|
||||
* @returns {boolean}
|
||||
*/
|
||||
/**
|
||||
* Checks if two `Hash`s are equal
|
||||
* @param {Hash} other
|
||||
* @returns {boolean}
|
||||
*/
|
||||
equals(other: Hash): boolean;
|
||||
/**
|
||||
* Return the `Uint8Array` representation of the hash
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
/**
|
||||
* Return the `Uint8Array` representation of the hash
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
toBytes(): Uint8Array;
|
||||
}
|
||||
/**
|
||||
* A directive for a single invocation of a Solana program.
|
||||
*
|
||||
* An instruction specifies which program it is calling, which accounts it may
|
||||
* read or modify, and additional data that serves as input to the program. One
|
||||
* or more instructions are included in transactions submitted by Solana
|
||||
* clients. Instructions are also used to describe [cross-program
|
||||
* invocations][cpi].
|
||||
*
|
||||
* [cpi]: https://docs.solana.com/developing/programming-model/calling-between-programs
|
||||
*
|
||||
* During execution, a program will receive a list of account data as one of
|
||||
* its arguments, in the same order as specified during `Instruction`
|
||||
* construction.
|
||||
*
|
||||
* While Solana is agnostic to the format of the instruction data, it has
|
||||
* built-in support for serialization via [`borsh`] and [`bincode`].
|
||||
*
|
||||
* [`borsh`]: https://docs.rs/borsh/latest/borsh/
|
||||
* [`bincode`]: https://docs.rs/bincode/latest/bincode/
|
||||
*
|
||||
* # Specifying account metadata
|
||||
*
|
||||
* When constructing an [`Instruction`], a list of all accounts that may be
|
||||
* read or written during the execution of that instruction must be supplied as
|
||||
* [`AccountMeta`] values.
|
||||
*
|
||||
* Any account whose data may be mutated by the program during execution must
|
||||
* be specified as writable. During execution, writing to an account that was
|
||||
* not specified as writable will cause the transaction to fail. Writing to an
|
||||
* account that is not owned by the program will cause the transaction to fail.
|
||||
*
|
||||
* Any account whose lamport balance may be mutated by the program during
|
||||
* execution must be specified as writable. During execution, mutating the
|
||||
* lamports of an account that was not specified as writable will cause the
|
||||
* transaction to fail. While _subtracting_ lamports from an account not owned
|
||||
* by the program will cause the transaction to fail, _adding_ lamports to any
|
||||
* account is allowed, as long is it is mutable.
|
||||
*
|
||||
* Accounts that are not read or written by the program may still be specified
|
||||
* in an `Instruction`'s account list. These will affect scheduling of program
|
||||
* execution by the runtime, but will otherwise be ignored.
|
||||
*
|
||||
* When building a transaction, the Solana runtime coalesces all accounts used
|
||||
* by all instructions in that transaction, along with accounts and permissions
|
||||
* required by the runtime, into a single account list. Some accounts and
|
||||
* account permissions required by the runtime to process a transaction are
|
||||
* _not_ required to be included in an `Instruction`s account list. These
|
||||
* include:
|
||||
*
|
||||
* - The program ID — it is a separate field of `Instruction`
|
||||
* - The transaction's fee-paying account — it is added during [`Message`]
|
||||
* construction. A program may still require the fee payer as part of the
|
||||
* account list if it directly references it.
|
||||
*
|
||||
* [`Message`]: crate::message::Message
|
||||
*
|
||||
* Programs may require signatures from some accounts, in which case they
|
||||
* should be specified as signers during `Instruction` construction. The
|
||||
* program must still validate during execution that the account is a signer.
|
||||
*/
|
||||
* A directive for a single invocation of a Solana program.
|
||||
*
|
||||
* An instruction specifies which program it is calling, which accounts it may
|
||||
* read or modify, and additional data that serves as input to the program. One
|
||||
* or more instructions are included in transactions submitted by Solana
|
||||
* clients. Instructions are also used to describe [cross-program
|
||||
* invocations][cpi].
|
||||
*
|
||||
* [cpi]: https://docs.solana.com/developing/programming-model/calling-between-programs
|
||||
*
|
||||
* During execution, a program will receive a list of account data as one of
|
||||
* its arguments, in the same order as specified during `Instruction`
|
||||
* construction.
|
||||
*
|
||||
* While Solana is agnostic to the format of the instruction data, it has
|
||||
* built-in support for serialization via [`borsh`] and [`bincode`].
|
||||
*
|
||||
* [`borsh`]: https://docs.rs/borsh/latest/borsh/
|
||||
* [`bincode`]: https://docs.rs/bincode/latest/bincode/
|
||||
*
|
||||
* # Specifying account metadata
|
||||
*
|
||||
* When constructing an [`Instruction`], a list of all accounts that may be
|
||||
* read or written during the execution of that instruction must be supplied as
|
||||
* [`AccountMeta`] values.
|
||||
*
|
||||
* Any account whose data may be mutated by the program during execution must
|
||||
* be specified as writable. During execution, writing to an account that was
|
||||
* not specified as writable will cause the transaction to fail. Writing to an
|
||||
* account that is not owned by the program will cause the transaction to fail.
|
||||
*
|
||||
* Any account whose lamport balance may be mutated by the program during
|
||||
* execution must be specified as writable. During execution, mutating the
|
||||
* lamports of an account that was not specified as writable will cause the
|
||||
* transaction to fail. While _subtracting_ lamports from an account not owned
|
||||
* by the program will cause the transaction to fail, _adding_ lamports to any
|
||||
* account is allowed, as long is it is mutable.
|
||||
*
|
||||
* Accounts that are not read or written by the program may still be specified
|
||||
* in an `Instruction`'s account list. These will affect scheduling of program
|
||||
* execution by the runtime, but will otherwise be ignored.
|
||||
*
|
||||
* When building a transaction, the Solana runtime coalesces all accounts used
|
||||
* by all instructions in that transaction, along with accounts and permissions
|
||||
* required by the runtime, into a single account list. Some accounts and
|
||||
* account permissions required by the runtime to process a transaction are
|
||||
* _not_ required to be included in an `Instruction`s account list. These
|
||||
* include:
|
||||
*
|
||||
* - The program ID — it is a separate field of `Instruction`
|
||||
* - The transaction's fee-paying account — it is added during [`Message`]
|
||||
* construction. A program may still require the fee payer as part of the
|
||||
* account list if it directly references it.
|
||||
*
|
||||
* [`Message`]: crate::message::Message
|
||||
*
|
||||
* Programs may require signatures from some accounts, in which case they
|
||||
* should be specified as signers during `Instruction` construction. The
|
||||
* program must still validate during execution that the account is a signer.
|
||||
*/
|
||||
export class Instruction {
|
||||
free(): void;
|
||||
}
|
||||
/**
|
||||
*/
|
||||
*/
|
||||
export class Instructions {
|
||||
free(): void;
|
||||
/**
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* @param {Instruction} instruction
|
||||
*/
|
||||
/**
|
||||
* @param {Instruction} instruction
|
||||
*/
|
||||
push(instruction: Instruction): void;
|
||||
}
|
||||
/**
|
||||
* A Solana transaction message (legacy).
|
||||
*
|
||||
* See the [`message`] module documentation for further description.
|
||||
*
|
||||
* [`message`]: crate::message
|
||||
*
|
||||
* Some constructors accept an optional `payer`, the account responsible for
|
||||
* paying the cost of executing a transaction. In most cases, callers should
|
||||
* specify the payer explicitly in these constructors. In some cases though,
|
||||
* the caller is not _required_ to specify the payer, but is still allowed to:
|
||||
* in the `Message` structure, the first account is always the fee-payer, so if
|
||||
* the caller has knowledge that the first account of the constructed
|
||||
* transaction's `Message` is both a signer and the expected fee-payer, then
|
||||
* redundantly specifying the fee-payer is not strictly required.
|
||||
*/
|
||||
* A Solana transaction message (legacy).
|
||||
*
|
||||
* See the [`message`] module documentation for further description.
|
||||
*
|
||||
* [`message`]: crate::message
|
||||
*
|
||||
* Some constructors accept an optional `payer`, the account responsible for
|
||||
* paying the cost of executing a transaction. In most cases, callers should
|
||||
* specify the payer explicitly in these constructors. In some cases though,
|
||||
* the caller is not _required_ to specify the payer, but is still allowed to:
|
||||
* in the `Message` structure, the first account is always the fee-payer, so if
|
||||
* the caller has knowledge that the first account of the constructed
|
||||
* transaction's `Message` is both a signer and the expected fee-payer, then
|
||||
* redundantly specifying the fee-payer is not strictly required.
|
||||
*/
|
||||
export class Message {
|
||||
free(): void;
|
||||
/**
|
||||
* The id of a recent ledger entry.
|
||||
*/
|
||||
/**
|
||||
* The id of a recent ledger entry.
|
||||
*/
|
||||
recent_blockhash: Hash;
|
||||
}
|
||||
/**
|
||||
* The address of a [Solana account][acc].
|
||||
*
|
||||
* Some account addresses are [ed25519] public keys, with corresponding secret
|
||||
* keys that are managed off-chain. Often, though, account addresses do not
|
||||
* have corresponding secret keys — as with [_program derived
|
||||
* addresses_][pdas] — or the secret key is not relevant to the operation
|
||||
* of a program, and may have even been disposed of. As running Solana programs
|
||||
* can not safely create or manage secret keys, the full [`Keypair`] is not
|
||||
* defined in `solana-program` but in `solana-sdk`.
|
||||
*
|
||||
* [acc]: https://docs.solana.com/developing/programming-model/accounts
|
||||
* [ed25519]: https://ed25519.cr.yp.to/
|
||||
* [pdas]: https://docs.solana.com/developing/programming-model/calling-between-programs#program-derived-addresses
|
||||
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
|
||||
*/
|
||||
* The address of a [Solana account][acc].
|
||||
*
|
||||
* Some account addresses are [ed25519] public keys, with corresponding secret
|
||||
* keys that are managed off-chain. Often, though, account addresses do not
|
||||
* have corresponding secret keys — as with [_program derived
|
||||
* addresses_][pdas] — or the secret key is not relevant to the operation
|
||||
* of a program, and may have even been disposed of. As running Solana programs
|
||||
* can not safely create or manage secret keys, the full [`Keypair`] is not
|
||||
* defined in `solana-program` but in `solana-sdk`.
|
||||
*
|
||||
* [acc]: https://docs.solana.com/developing/programming-model/accounts
|
||||
* [ed25519]: https://ed25519.cr.yp.to/
|
||||
* [pdas]: https://docs.solana.com/developing/programming-model/calling-between-programs#program-derived-addresses
|
||||
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
|
||||
*/
|
||||
export class Pubkey {
|
||||
free(): void;
|
||||
/**
|
||||
* Create a new Pubkey object
|
||||
*
|
||||
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
|
||||
* @param {any} value
|
||||
*/
|
||||
/**
|
||||
* Create a new Pubkey object
|
||||
*
|
||||
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
|
||||
* @param {any} value
|
||||
*/
|
||||
constructor(value: any);
|
||||
/**
|
||||
* Return the base58 string representation of the public key
|
||||
* @returns {string}
|
||||
*/
|
||||
/**
|
||||
* Return the base58 string representation of the public key
|
||||
* @returns {string}
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Check if a `Pubkey` is on the ed25519 curve.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
/**
|
||||
* Check if a `Pubkey` is on the ed25519 curve.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isOnCurve(): boolean;
|
||||
/**
|
||||
* Checks if two `Pubkey`s are equal
|
||||
* @param {Pubkey} other
|
||||
* @returns {boolean}
|
||||
*/
|
||||
/**
|
||||
* Checks if two `Pubkey`s are equal
|
||||
* @param {Pubkey} other
|
||||
* @returns {boolean}
|
||||
*/
|
||||
equals(other: Pubkey): boolean;
|
||||
/**
|
||||
* Return the `Uint8Array` representation of the public key
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
/**
|
||||
* Return the `Uint8Array` representation of the public key
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
toBytes(): Uint8Array;
|
||||
/**
|
||||
* Derive a Pubkey from another Pubkey, string seed, and a program id
|
||||
* @param {Pubkey} base
|
||||
* @param {string} seed
|
||||
* @param {Pubkey} owner
|
||||
* @returns {Pubkey}
|
||||
*/
|
||||
/**
|
||||
* Derive a Pubkey from another Pubkey, string seed, and a program id
|
||||
* @param {Pubkey} base
|
||||
* @param {string} seed
|
||||
* @param {Pubkey} owner
|
||||
* @returns {Pubkey}
|
||||
*/
|
||||
static createWithSeed(base: Pubkey, seed: string, owner: Pubkey): Pubkey;
|
||||
/**
|
||||
* Derive a program address from seeds and a program id
|
||||
* @param {any[]} seeds
|
||||
* @param {Pubkey} program_id
|
||||
* @returns {Pubkey}
|
||||
*/
|
||||
/**
|
||||
* Derive a program address from seeds and a program id
|
||||
* @param {any[]} seeds
|
||||
* @param {Pubkey} program_id
|
||||
* @returns {Pubkey}
|
||||
*/
|
||||
static createProgramAddress(seeds: any[], program_id: Pubkey): Pubkey;
|
||||
/**
|
||||
* Find a valid program address
|
||||
*
|
||||
* Returns:
|
||||
* * `[PubKey, number]` - the program address and bump seed
|
||||
* @param {any[]} seeds
|
||||
* @param {Pubkey} program_id
|
||||
* @returns {any}
|
||||
*/
|
||||
/**
|
||||
* Find a valid program address
|
||||
*
|
||||
* Returns:
|
||||
* * `[PubKey, number]` - the program address and bump seed
|
||||
* @param {any[]} seeds
|
||||
* @param {Pubkey} program_id
|
||||
* @returns {any}
|
||||
*/
|
||||
static findProgramAddress(seeds: any[], program_id: Pubkey): any;
|
||||
}
|
||||
|
30
worker/tests/wasm/bincode_js_bg.wasm.d.ts
vendored
30
worker/tests/wasm/bincode_js_bg.wasm.d.ts
vendored
@ -8,13 +8,37 @@ export function __wbg_get_message_recent_blockhash(a: number): number;
|
||||
export function __wbg_set_message_recent_blockhash(a: number, b: number): void;
|
||||
export function solana_program_init(): void;
|
||||
export function systeminstruction_createAccount(a: number, b: number, c: number, d: number, e: number): number;
|
||||
export function systeminstruction_createAccountWithSeed(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
||||
export function systeminstruction_createAccountWithSeed(
|
||||
a: number,
|
||||
b: number,
|
||||
c: number,
|
||||
d: number,
|
||||
e: number,
|
||||
f: number,
|
||||
g: number,
|
||||
h: number,
|
||||
): number;
|
||||
export function systeminstruction_assign(a: number, b: number): number;
|
||||
export function systeminstruction_assignWithSeed(a: number, b: number, c: number, d: number, e: number): number;
|
||||
export function systeminstruction_transfer(a: number, b: number, c: number): number;
|
||||
export function systeminstruction_transferWithSeed(a: number, b: number, c: number, d: number, e: number, f: number, g: number): number;
|
||||
export function systeminstruction_transferWithSeed(
|
||||
a: number,
|
||||
b: number,
|
||||
c: number,
|
||||
d: number,
|
||||
e: number,
|
||||
f: number,
|
||||
g: number,
|
||||
): number;
|
||||
export function systeminstruction_allocate(a: number, b: number): number;
|
||||
export function systeminstruction_allocateWithSeed(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
||||
export function systeminstruction_allocateWithSeed(
|
||||
a: number,
|
||||
b: number,
|
||||
c: number,
|
||||
d: number,
|
||||
e: number,
|
||||
f: number,
|
||||
): number;
|
||||
export function systeminstruction_createNonceAccount(a: number, b: number, c: number, d: number): number;
|
||||
export function systeminstruction_advanceNonceAccount(a: number, b: number): number;
|
||||
export function systeminstruction_withdrawNonceAccount(a: number, b: number, c: number, d: number): number;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import path from 'path'
|
||||
import Dotenv from 'dotenv-webpack'
|
||||
import path from "path";
|
||||
import Dotenv from "dotenv-webpack";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
@ -11,12 +11,12 @@ export default {
|
||||
filename: "main.js",
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
libraryTarget: "commonjs2",
|
||||
clean: true
|
||||
clean: true,
|
||||
},
|
||||
target: "node",
|
||||
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"]
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
|
||||
module: {
|
||||
@ -26,16 +26,14 @@ export default {
|
||||
use: {
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
transpileOnly: true
|
||||
}
|
||||
transpileOnly: true,
|
||||
},
|
||||
},
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
plugins: [
|
||||
|
||||
],
|
||||
plugins: [],
|
||||
devtool: "source-map",
|
||||
};
|
||||
|
Reference in New Issue
Block a user