Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

beaker-ts

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beaker-ts - npm Package Compare versions

Comparing version 0.0.61 to 0.0.70

examples/box/application.json

12

examples/amm/constantproductamm_client.ts

@@ -30,3 +30,3 @@ import algosdk from "algosdk";

}, txnParams?: bkr.TransactionOverrides): Promise<bkr.ABIResult<void>> {
const result = await this.execute(await this.compose.burn({ pool_xfer: args.pool_xfer, pool_asset: args.pool_asset === undefined ? await this.resolve("global-state", "p") as bigint : args.pool_asset, a_asset: args.a_asset === undefined ? await this.resolve("global-state", "a") as bigint : args.a_asset, b_asset: args.b_asset === undefined ? await this.resolve("global-state", "b") as bigint : args.b_asset }, txnParams));
const result = await this.execute(await this.compose.burn({ pool_xfer: args.pool_xfer, pool_asset: args.pool_asset === undefined ? await this._resolve("global-state", "p") as bigint : args.pool_asset, a_asset: args.a_asset === undefined ? await this._resolve("global-state", "a") as bigint : args.a_asset, b_asset: args.b_asset === undefined ? await this._resolve("global-state", "b") as bigint : args.b_asset }, txnParams));
return new bkr.ABIResult<void>(result);

@@ -41,3 +41,3 @@ }

}, txnParams?: bkr.TransactionOverrides): Promise<bkr.ABIResult<void>> {
const result = await this.execute(await this.compose.mint({ a_xfer: args.a_xfer, b_xfer: args.b_xfer, pool_asset: args.pool_asset === undefined ? await this.resolve("global-state", "p") as bigint : args.pool_asset, a_asset: args.a_asset === undefined ? await this.resolve("global-state", "a") as bigint : args.a_asset, b_asset: args.b_asset === undefined ? await this.resolve("global-state", "b") as bigint : args.b_asset }, txnParams));
const result = await this.execute(await this.compose.mint({ a_xfer: args.a_xfer, b_xfer: args.b_xfer, pool_asset: args.pool_asset === undefined ? await this._resolve("global-state", "p") as bigint : args.pool_asset, a_asset: args.a_asset === undefined ? await this._resolve("global-state", "a") as bigint : args.a_asset, b_asset: args.b_asset === undefined ? await this._resolve("global-state", "b") as bigint : args.b_asset }, txnParams));
return new bkr.ABIResult<void>(result);

@@ -56,3 +56,3 @@ }

}, txnParams?: bkr.TransactionOverrides): Promise<bkr.ABIResult<void>> {
const result = await this.execute(await this.compose.swap({ swap_xfer: args.swap_xfer, a_asset: args.a_asset === undefined ? await this.resolve("global-state", "a") as bigint : args.a_asset, b_asset: args.b_asset === undefined ? await this.resolve("global-state", "b") as bigint : args.b_asset }, txnParams));
const result = await this.execute(await this.compose.swap({ swap_xfer: args.swap_xfer, a_asset: args.a_asset === undefined ? await this._resolve("global-state", "a") as bigint : args.a_asset, b_asset: args.b_asset === undefined ? await this._resolve("global-state", "b") as bigint : args.b_asset }, txnParams));
return new bkr.ABIResult<void>(result);

@@ -74,3 +74,3 @@ }

}, txnParams?: bkr.TransactionOverrides, atc?: algosdk.AtomicTransactionComposer): Promise<algosdk.AtomicTransactionComposer> => {
return this.addMethodCall(algosdk.getMethodByName(this.methods, "burn"), { pool_xfer: args.pool_xfer, pool_asset: args.pool_asset === undefined ? await this.resolve("global-state", "p") : args.pool_asset, a_asset: args.a_asset === undefined ? await this.resolve("global-state", "a") : args.a_asset, b_asset: args.b_asset === undefined ? await this.resolve("global-state", "b") : args.b_asset }, txnParams, atc);
return this.addMethodCall(algosdk.getMethodByName(this.methods, "burn"), { pool_xfer: args.pool_xfer, pool_asset: args.pool_asset === undefined ? await this._resolve("global-state", "p") : args.pool_asset, a_asset: args.a_asset === undefined ? await this._resolve("global-state", "a") : args.a_asset, b_asset: args.b_asset === undefined ? await this._resolve("global-state", "b") : args.b_asset }, txnParams, atc);
},

@@ -84,3 +84,3 @@ mint: async (args: {

}, txnParams?: bkr.TransactionOverrides, atc?: algosdk.AtomicTransactionComposer): Promise<algosdk.AtomicTransactionComposer> => {
return this.addMethodCall(algosdk.getMethodByName(this.methods, "mint"), { a_xfer: args.a_xfer, b_xfer: args.b_xfer, pool_asset: args.pool_asset === undefined ? await this.resolve("global-state", "p") : args.pool_asset, a_asset: args.a_asset === undefined ? await this.resolve("global-state", "a") : args.a_asset, b_asset: args.b_asset === undefined ? await this.resolve("global-state", "b") : args.b_asset }, txnParams, atc);
return this.addMethodCall(algosdk.getMethodByName(this.methods, "mint"), { a_xfer: args.a_xfer, b_xfer: args.b_xfer, pool_asset: args.pool_asset === undefined ? await this._resolve("global-state", "p") : args.pool_asset, a_asset: args.a_asset === undefined ? await this._resolve("global-state", "a") : args.a_asset, b_asset: args.b_asset === undefined ? await this._resolve("global-state", "b") : args.b_asset }, txnParams, atc);
},

@@ -97,5 +97,5 @@ set_governor: async (args: {

}, txnParams?: bkr.TransactionOverrides, atc?: algosdk.AtomicTransactionComposer): Promise<algosdk.AtomicTransactionComposer> => {
return this.addMethodCall(algosdk.getMethodByName(this.methods, "swap"), { swap_xfer: args.swap_xfer, a_asset: args.a_asset === undefined ? await this.resolve("global-state", "a") : args.a_asset, b_asset: args.b_asset === undefined ? await this.resolve("global-state", "b") : args.b_asset }, txnParams, atc);
return this.addMethodCall(algosdk.getMethodByName(this.methods, "swap"), { swap_xfer: args.swap_xfer, a_asset: args.a_asset === undefined ? await this._resolve("global-state", "a") : args.a_asset, b_asset: args.b_asset === undefined ? await this._resolve("global-state", "b") : args.b_asset }, txnParams, atc);
}
};
}

@@ -18,3 +18,3 @@ import algosdk from "algosdk";

}, txnParams?: bkr.TransactionOverrides): Promise<bkr.ABIResult<Uint8Array>> {
const result = await this.execute(await this.compose.hash_it({ input: args.input, iters: args.iters, opup_app: args.opup_app === undefined ? await this.resolve("global-state", "ouaid") as bigint : args.opup_app }, txnParams));
const result = await this.execute(await this.compose.hash_it({ input: args.input, iters: args.iters, opup_app: args.opup_app === undefined ? await this._resolve("global-state", "ouaid") as bigint : args.opup_app }, txnParams));
return new bkr.ABIResult<Uint8Array>(result, result.returnValue as Uint8Array);

@@ -34,3 +34,3 @@ }

}, txnParams?: bkr.TransactionOverrides, atc?: algosdk.AtomicTransactionComposer): Promise<algosdk.AtomicTransactionComposer> => {
return this.addMethodCall(algosdk.getMethodByName(this.methods, "hash_it"), { input: args.input, iters: args.iters, opup_app: args.opup_app === undefined ? await this.resolve("global-state", "ouaid") : args.opup_app }, txnParams, atc);
return this.addMethodCall(algosdk.getMethodByName(this.methods, "hash_it"), { input: args.input, iters: args.iters, opup_app: args.opup_app === undefined ? await this._resolve("global-state", "ouaid") : args.opup_app }, txnParams, atc);
},

@@ -37,0 +37,0 @@ opup_bootstrap: async (args: {

@@ -67,5 +67,7 @@ import algosdk, { AtomicTransactionComposer } from 'algosdk';

wrapLogicError(e: Error): Error;
resolve(source: string, data: bigint | number | string | Uint8Array): Promise<MethodArg>;
_resolve(source: string, data: bigint | number | string | Uint8Array): Promise<MethodArg>;
getSuggestedParams(txParams?: TransactionOverrides, coverInners?: number): Promise<algosdk.SuggestedParams>;
getApplicationState(raw?: boolean): Promise<ApplicationState>;
getApplicationBoxNames(): Promise<Uint8Array[]>;
getApplicationBox(boxName: string | Uint8Array): Promise<Uint8Array>;
getAccountState(address?: string, raw?: boolean): Promise<AccountState>;

@@ -72,0 +74,0 @@ private getSender;

@@ -342,3 +342,3 @@ "use strict";

}
async resolve(source, data) {
async _resolve(source, data) {
let val;

@@ -393,2 +393,17 @@ switch (source) {

}
async getApplicationBoxNames() {
const boxResult = await this.client.getApplicationBoxes(this.appId).do();
return boxResult.boxes.map((b) => {
return b.name;
});
}
async getApplicationBox(boxName) {
if (typeof boxName === 'string') {
boxName = new Uint8Array(Buffer.from(boxName));
}
const boxResult = await this.client
.getApplicationBoxByName(this.appId, boxName)
.do();
return boxResult.value;
}
async getAccountState(address, raw) {

@@ -395,0 +410,0 @@ if (address === undefined)

@@ -181,3 +181,3 @@ "use strict";

}
argVal = factory.createConditionalExpression(factory.createBinaryExpression(argVal, factory.createToken(typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken), factory.createIdentifier('undefined')), factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), factory.createAsExpression(factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('this.resolve'), undefined, [factory.createStringLiteral(defaultArg.source), data])), argType), factory.createToken(typescript_1.default.SyntaxKind.ColonToken), argVal);
argVal = factory.createConditionalExpression(factory.createBinaryExpression(argVal, factory.createToken(typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken), factory.createIdentifier('undefined')), factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), factory.createAsExpression(factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('this._resolve'), undefined, [factory.createStringLiteral(defaultArg.source), data])), argType), factory.createToken(typescript_1.default.SyntaxKind.ColonToken), argVal);
}

@@ -280,3 +280,3 @@ abiMethodArgs.push(factory.createPropertyAssignment(argName, argVal));

}
argVal = factory.createConditionalExpression(factory.createBinaryExpression(argVal, factory.createToken(typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken), factory.createIdentifier('undefined')), factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('this.resolve'), undefined, [factory.createStringLiteral(defaultArg.source), data])), factory.createToken(typescript_1.default.SyntaxKind.ColonToken), argVal);
argVal = factory.createConditionalExpression(factory.createBinaryExpression(argVal, factory.createToken(typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken), factory.createIdentifier('undefined')), factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('this._resolve'), undefined, [factory.createStringLiteral(defaultArg.source), data])), factory.createToken(typescript_1.default.SyntaxKind.ColonToken), argVal);
}

@@ -283,0 +283,0 @@ abiMethodArgs.push(factory.createPropertyAssignment(argName, argVal));

{
"name": "beaker-ts",
"version": "0.0.61",
"version": "0.0.70",
"description": "",

@@ -19,2 +19,4 @@ "main": "./lib/index.js",

"avm7": "npx tsx examples/demo_avm7/index.ts",
"genbox": "npm run beaker -- generate --local examples/box/application.json examples/box/",
"box": "npx tsx examples/box/index.ts",
"regen": "npm run genhello && npm run genstructer && npm run genopup && npm run genavm7 && npm run genamm",

@@ -50,3 +52,3 @@ "lint": "eslint \"src/**/*.ts\"",

"algorand-walletconnect-qrcode-modal": "^1.6.1",
"algosdk": "^1.21.0",
"algosdk": "^2.0.0",
"buffer": "^6.0.3",

@@ -53,0 +55,0 @@ "commander": "^9.4.0",

@@ -425,3 +425,3 @@ import algosdk, { ABIReferenceType, AtomicTransactionComposer } from 'algosdk';

async resolve(
async _resolve(
source: string,

@@ -491,2 +491,21 @@ data: bigint | number | string | Uint8Array,

async getApplicationBoxNames(): Promise<Uint8Array[]> {
const boxResult = await this.client.getApplicationBoxes(this.appId).do();
return boxResult.boxes.map((b) => {
return b.name;
});
}
async getApplicationBox(boxName: string | Uint8Array): Promise<Uint8Array> {
if (typeof boxName === 'string') {
boxName = new Uint8Array(Buffer.from(boxName));
}
const boxResult = await this.client
.getApplicationBoxByName(this.appId, boxName)
.do();
return boxResult.value;
}
async getAccountState(

@@ -493,0 +512,0 @@ address?: string,

@@ -300,3 +300,3 @@ import type {

factory.createCallExpression(
factory.createIdentifier('this.resolve'),
factory.createIdentifier('this._resolve'),
undefined,

@@ -543,3 +543,3 @@ [factory.createStringLiteral(defaultArg.source), data],

factory.createCallExpression(
factory.createIdentifier('this.resolve'),
factory.createIdentifier('this._resolve'),
undefined,

@@ -546,0 +546,0 @@ [factory.createStringLiteral(defaultArg.source), data],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc