chore: make pst and toy-contract in crates use repository version of SDK
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
lib
|
||||
src/__tests__/integration/data
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint", "prettier"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"no-console": 1, // warning
|
||||
"multiline-ternary": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-multiple-empty-lines": "off",
|
||||
"prettier/prettier": 2 // error
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
lib
|
||||
src/__tests__/integration/data
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"semi": true,
|
||||
"trailingComma": "none",
|
||||
"singleQuote": true,
|
||||
"printWidth": 120
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
module.exports = {
|
||||
// Automatically clear mock calls and instances between every test
|
||||
clearMocks: true,
|
||||
|
||||
moduleFileExtensions: ['ts', 'js'],
|
||||
|
||||
testPathIgnorePatterns: ['/tests\/data/'],
|
||||
|
||||
testEnvironment: 'node',
|
||||
|
||||
transformIgnorePatterns: ['<rootDir>/node_modules/(?!@assemblyscript/.*)'],
|
||||
|
||||
transform: {
|
||||
'^.+\\.(ts|js)$': 'ts-jest',
|
||||
},
|
||||
};
|
||||
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"name": "warp-rust-template",
|
||||
"version": "0.0.1",
|
||||
"description": "Warp WASM Rust contract template",
|
||||
"main": "index.js",
|
||||
"author": "Redstone Team <dev@redstone.finance>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "wasm-pack build --target nodejs --release --out-name rust-contract contract/implementation",
|
||||
"build:dev": "wasm-pack build --target nodejs --dev --out-name rust-contract contract/implementation",
|
||||
"gen-bindings": "yarn gen-json && yarn gen-ts",
|
||||
"gen-json": "GENERATE_JSON=1 cargo test generate_json -- --nocapture && yarn format:json-bindings",
|
||||
"gen-ts": "ts-node --transpileOnly ./scripts/generate-ts.ts && yarn format:ts-bindings",
|
||||
"test": "jest ./tests",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"format:json-bindings": "eslint 'contract/definition/bindings/json/*.json' --fix",
|
||||
"format:ts-bindings": "eslint 'contract/definition/bindings/ts/*.ts' --fix",
|
||||
"prettier:format": "prettier --config .prettierrc '**/**/*.ts' --write",
|
||||
"deploy:local": "yarn build && node deploy/local/deploy-local.js",
|
||||
"deploy:testnet": "yarn build && node deploy/testnet/deploy-test.js",
|
||||
"deploy:mainnet": "yarn build && node deploy/mainnet/deploy-mainnet.js",
|
||||
"read:local": "node deploy/local/read-contract-state-local.js",
|
||||
"read:testnet": "node deploy/testnet/read-contract-state-testnet.js",
|
||||
"read:mainnet": "node deploy/mainnet/read-contract-state-mainnet.js",
|
||||
"transfer:local": "node deploy/local/interact-transfer-local.js",
|
||||
"transfer:testnet": "node deploy/testnet/interact-transfer-testnet.js",
|
||||
"transfer:mainnet": "node deploy/mainnet/interact-transfer-mainnet.js",
|
||||
"balance:local": "node deploy/local/interact-balance-local.js",
|
||||
"balance:testnet": "node deploy/testnet/interact-balance-testnet.js",
|
||||
"balance:mainnet": "node deploy/mainnet/interact-balance-mainnet.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"arlocal": "^1.1.59",
|
||||
"arweave": "1.12.4",
|
||||
"json-schema-to-typescript": "^11.0.1",
|
||||
"typescript": "^4.6.2",
|
||||
"warp-contracts": "1.2.56",
|
||||
"warp-contracts-plugin-deploy": "1.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"arweave": "1.12.4"
|
||||
},
|
||||
"overrides": {
|
||||
"arweave": "1.12.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^18.6.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.40.0",
|
||||
"@typescript-eslint/parser": "^5.40.0",
|
||||
"eslint": "^8.25.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"jest": "^28.1.3",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^28.0.7",
|
||||
"ts-node": "^10.9.1"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import { readdirSync, writeFileSync, mkdirSync, readFileSync } from 'node:fs';
|
||||
import { compileFromFile } from 'json-schema-to-typescript';
|
||||
import { writeImplementationFile } from './generation-utils';
|
||||
|
||||
const BINDINGS_ROOT = './contract/definition/bindings';
|
||||
const BINDINGS_ROOT = './crates/pst/contract/definition/bindings';
|
||||
const BINDINGS_JSON = join(BINDINGS_ROOT, 'json');
|
||||
const BINDINGS_TS = join(BINDINGS_ROOT, 'ts');
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export const writeImplementationFile = async (bindings: any, actions: any[]) =>
|
||||
/**
|
||||
* This file was automatically generated. Do not modify it, if you encounter any problems \n- please raise an issue: https://github.com/warp-contracts/warp-wasm-templates/issues.
|
||||
*/\n\n
|
||||
import { WriteInteractionOptions, WriteInteractionResponse, Contract, Warp, ArWallet, ContractError, EvaluationOptions } from 'warp-contracts';\nimport { ${actionsView} } from './View';\nimport { ${actionsWrite} } from './WriteAction';\nimport { State } from './ContractState';\n\n`;
|
||||
import { WriteInteractionOptions, WriteInteractionResponse, Contract, Warp, ArWallet, ContractError, EvaluationOptions } from '../../../../../..';\nimport { ${actionsView} } from './View';\nimport { ${actionsWrite} } from './WriteAction';\nimport { State } from './ContractState';\n\n`;
|
||||
resImpl += `
|
||||
export interface BaseInput {
|
||||
function: string;
|
||||
@@ -89,7 +89,7 @@ export const interfaceString = (interfaceName: string, properties: string) => {
|
||||
|
||||
// eslint-disable-next-line
|
||||
const getFunctionNames = (list: any[]) => {
|
||||
const functionNames = [];
|
||||
const functionNames = [] as string[];
|
||||
for (const typeObj of list) {
|
||||
const functionName = typeObj.title;
|
||||
functionName != 'function' && functionNames.push(functionName.charAt(0).toUpperCase() + functionName.slice(1));
|
||||
@@ -99,7 +99,7 @@ const getFunctionNames = (list: any[]) => {
|
||||
|
||||
const getActionsName = (action) => {
|
||||
let actionsName = ``;
|
||||
let actionsFunctions = [];
|
||||
let actionsFunctions = [] as string[];
|
||||
actionsFunctions = [...actionsFunctions, ...getFunctionNames(action.oneOf || action.anyOf)];
|
||||
actionsFunctions.forEach((a) => {
|
||||
actionsFunctions.indexOf(a) == actionsFunctions.length - 1 ? (actionsName += a) : (actionsName += `${a}, `);
|
||||
@@ -107,7 +107,8 @@ const getActionsName = (action) => {
|
||||
return actionsName;
|
||||
};
|
||||
|
||||
const implName = path.basename(process.cwd());
|
||||
// const implName = path.basename(process.cwd());
|
||||
const implName = 'pst';
|
||||
|
||||
const makeFirstCharUpper = (s: string) => {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
|
||||
@@ -8,12 +8,13 @@ import {
|
||||
LoggerFactory,
|
||||
PstState,
|
||||
Warp,
|
||||
SmartWeaveTags,
|
||||
SMART_WEAVE_TAGS,
|
||||
WARP_TAGS,
|
||||
WarpFactory,
|
||||
TagsParser,
|
||||
ArweaveWrapper,
|
||||
WasmSrc
|
||||
} from 'warp-contracts';
|
||||
} from '../../..';
|
||||
import { DeployPlugin } from 'warp-contracts-plugin-deploy';
|
||||
import path from 'path';
|
||||
import { PstContract } from '../contract/definition/bindings/ts/PstContract';
|
||||
@@ -134,11 +135,11 @@ describe('Testing the Rust WASM Profit Sharing Token', () => {
|
||||
const contractTx = await arweave.transactions.get(contractTxId);
|
||||
expect(contractTx).not.toBeNull();
|
||||
|
||||
const contractSrcTxId = tagsParser.getTag(contractTx, SmartWeaveTags.CONTRACT_SRC_TX_ID);
|
||||
const contractSrcTxId = tagsParser.getTag(contractTx, SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID);
|
||||
const contractSrcTx = await arweave.transactions.get(contractSrcTxId);
|
||||
expect(tagsParser.getTag(contractSrcTx, SmartWeaveTags.CONTENT_TYPE)).toEqual('application/wasm');
|
||||
expect(tagsParser.getTag(contractSrcTx, SmartWeaveTags.WASM_LANG)).toEqual('rust');
|
||||
expect(tagsParser.getTag(contractSrcTx, SmartWeaveTags.WASM_META)).toBeTruthy();
|
||||
expect(tagsParser.getTag(contractSrcTx, SMART_WEAVE_TAGS.CONTENT_TYPE)).toEqual('application/wasm');
|
||||
expect(tagsParser.getTag(contractSrcTx, WARP_TAGS.WASM_LANG)).toEqual('rust');
|
||||
expect(tagsParser.getTag(contractSrcTx, WARP_TAGS.WASM_META)).toBeTruthy();
|
||||
|
||||
const srcTxData = await arweaveWrapper.txData(contractSrcTxId);
|
||||
const wasmSrc = new WasmSrc(srcTxData);
|
||||
@@ -318,7 +319,7 @@ describe('Testing the Rust WASM Profit Sharing Token', () => {
|
||||
});
|
||||
|
||||
xit('should return stable gas results', async () => {
|
||||
const results = [];
|
||||
const results: InteractionResult<State, unknown>[] = [];
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const result = await pst.contract.dryWrite(
|
||||
@@ -358,7 +359,7 @@ describe('Testing the Rust WASM Profit Sharing Token', () => {
|
||||
);
|
||||
|
||||
expect(result.type).toEqual('exception');
|
||||
expect(result.errorMessage.startsWith('[RE:OOG] Out of gas!')).toBeTruthy();
|
||||
expect(result.errorMessage?.startsWith('[RE:OOG] Out of gas!')).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should properly evolve contract's source code", async () => {
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2018",
|
||||
"lib": ["dom"],
|
||||
"esModuleInterop": true,
|
||||
"downlevelIteration": true
|
||||
},
|
||||
"exclude": ["node_modules", "tools", "contract/implementation/pkg"]
|
||||
}
|
||||
7326
crates/pst/yarn.lock
7326
crates/pst/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
||||
module.exports = {
|
||||
// Automatically clear mock calls and instances between every test
|
||||
clearMocks: true,
|
||||
|
||||
moduleFileExtensions: ['ts', 'js'],
|
||||
|
||||
testPathIgnorePatterns: ['/tests\/data/'],
|
||||
|
||||
testEnvironment: 'node',
|
||||
|
||||
transformIgnorePatterns: ['<rootDir>/node_modules/(?!@assemblyscript/.*)'],
|
||||
|
||||
transform: {
|
||||
'^.+\\.(ts|js)$': 'ts-jest',
|
||||
},
|
||||
};
|
||||
@@ -1,64 +0,0 @@
|
||||
{
|
||||
"name": "warp-rust-template",
|
||||
"version": "0.0.1",
|
||||
"description": "Warp WASM Rust contract template",
|
||||
"main": "index.js",
|
||||
"author": "Redstone Team <dev@redstone.finance>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "wasm-pack build --target nodejs --release --out-name rust-contract .",
|
||||
"build:dev": "wasm-pack build --target nodejs --dev --out-name rust-contract .",
|
||||
"build:profiling": "wasm-pack build --target nodejs --profiling --out-name rust-contract .",
|
||||
"gen-bindings": "yarn gen-json && yarn gen-ts",
|
||||
"gen-json": "GENERATE_JSON=1 cargo test generate_json -- --nocapture && yarn format:json-bindings",
|
||||
"gen-ts": "ts-node --transpileOnly ./scripts/generate-ts.ts && yarn format:ts-bindings",
|
||||
"test": "jest ./tests",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"format:json-bindings": "eslint 'contract/definition/bindings/json/*.json' --fix",
|
||||
"format:ts-bindings": "eslint 'contract/definition/bindings/ts/*.ts' --fix",
|
||||
"prettier:format": "prettier --config .prettierrc '**/**/*.ts' --write",
|
||||
"deploy:local": "yarn build && node deploy/local/deploy-local.js",
|
||||
"deploy:testnet": "yarn build && node deploy/testnet/deploy-test.js",
|
||||
"deploy:mainnet": "yarn build && node deploy/mainnet/deploy-mainnet.js",
|
||||
"read:local": "node deploy/local/read-contract-state-local.js",
|
||||
"read:testnet": "node deploy/testnet/read-contract-state-testnet.js",
|
||||
"read:mainnet": "node deploy/mainnet/read-contract-state-mainnet.js",
|
||||
"transfer:local": "node deploy/local/interact-transfer-local.js",
|
||||
"transfer:testnet": "node deploy/testnet/interact-transfer-testnet.js",
|
||||
"transfer:mainnet": "node deploy/mainnet/interact-transfer-mainnet.js",
|
||||
"balance:local": "node deploy/local/interact-balance-local.js",
|
||||
"balance:testnet": "node deploy/testnet/interact-balance-testnet.js",
|
||||
"balance:mainnet": "node deploy/mainnet/interact-balance-mainnet.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"arlocal": "^1.1.59",
|
||||
"arweave": "1.12.4",
|
||||
"json-schema-to-typescript": "^11.0.1",
|
||||
"typescript": "^4.6.2",
|
||||
"warp-contracts": "1.2.56",
|
||||
"warp-contracts-plugin-deploy": "^1.0.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"arweave": "1.12.4"
|
||||
},
|
||||
"overrides": {
|
||||
"arweave": "1.12.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^18.6.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.40.0",
|
||||
"@typescript-eslint/parser": "^5.40.0",
|
||||
"eslint": "^8.25.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"jest": "^28.1.3",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^28.0.7",
|
||||
"ts-node": "^10.9.1"
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,14 @@ import { JWKInterface } from 'arweave/node/lib/wallet';
|
||||
import {
|
||||
LoggerFactory,
|
||||
Warp,
|
||||
SmartWeaveTags,
|
||||
SMART_WEAVE_TAGS,
|
||||
WARP_TAGS,
|
||||
WarpFactory,
|
||||
TagsParser,
|
||||
ArweaveWrapper,
|
||||
WasmSrc,
|
||||
Contract
|
||||
} from 'warp-contracts';
|
||||
} from '../../..';
|
||||
import { DeployPlugin } from 'warp-contracts-plugin-deploy';
|
||||
import path from 'path';
|
||||
|
||||
@@ -90,11 +91,11 @@ describe('Testing the Rust WASM Profit Sharing Token', () => {
|
||||
const contractTx = await arweave.transactions.get(contractTxId);
|
||||
expect(contractTx).not.toBeNull();
|
||||
|
||||
const contractSrcTxId = tagsParser.getTag(contractTx, SmartWeaveTags.CONTRACT_SRC_TX_ID);
|
||||
const contractSrcTxId = tagsParser.getTag(contractTx, SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID);
|
||||
const contractSrcTx = await arweave.transactions.get(contractSrcTxId);
|
||||
expect(tagsParser.getTag(contractSrcTx, SmartWeaveTags.CONTENT_TYPE)).toEqual('application/wasm');
|
||||
expect(tagsParser.getTag(contractSrcTx, SmartWeaveTags.WASM_LANG)).toEqual('rust');
|
||||
expect(tagsParser.getTag(contractSrcTx, SmartWeaveTags.WASM_META)).toBeTruthy();
|
||||
expect(tagsParser.getTag(contractSrcTx, SMART_WEAVE_TAGS.CONTENT_TYPE)).toEqual('application/wasm');
|
||||
expect(tagsParser.getTag(contractSrcTx, WARP_TAGS.WASM_LANG)).toEqual('rust');
|
||||
expect(tagsParser.getTag(contractSrcTx, WARP_TAGS.WASM_META)).toBeTruthy();
|
||||
|
||||
const srcTxData = await arweaveWrapper.txData(contractSrcTxId);
|
||||
const wasmSrc = new WasmSrc(srcTxData);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2018",
|
||||
"lib": ["dom"],
|
||||
"esModuleInterop": true,
|
||||
"downlevelIteration": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
# Warp contracts
|
||||
|
||||
`warp-contracts` is an inherent part of [Warp SDK](https://github.com/warp-contracts/warp). This library allows for smooth integration with Warp implementation of SmartWeave protocol.
|
||||
`warp-contracts` crate is an inherent part of [Warp SDK](https://github.com/warp-contracts/warp). This library allows for smooth integration with Warp implementation of SmartWeave protocol.
|
||||
|
||||
| Feature | Yes/No |
|
||||
| ---------------------- | ----------- |
|
||||
|
||||
Reference in New Issue
Block a user