Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ TS_RS_EXPORT_DIR = { value = "psy_sdk/psy-ts-sdk/packages/psy-sdk/src/types", re

[target.wasm32-unknown-unknown]
rustflags = [
"-C", "target-feature=+atomics",
"-C", "panic=abort",
'--cfg', 'getrandom_backend="js"'
]

[unstable]
build-std = ["panic_abort", "std"]
# build-std-features = ["panic_immediate_abort"]
60 changes: 30 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ plonky2 = { git = "https://github.com/PsyProtocol/plonky2-hwa", rev = "1dfe6112c
] }
plonky2_maybe_rayon = { git = "https://github.com/PsyProtocol/plonky2-hwa", rev = "1dfe6112c3eca3668c15820755371a8a3e75f934" }

psy_vm = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_vm", default-features = false }
psy_crypto = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_crypto" }
psy_data = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_client_data", default-features = false }
psy_common = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_client_common" }
psy_config = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_config" }
psy_prover = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_prover", default-features = false }
psy_provider = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_provider" }
psy_common_circuit = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_common_circuit", default-features = false }
psy_dpn_circuit = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "c42e117900676ba839ae4d4d9de362da9008d5cb", package = "psy_dpn_circuit", default-features = false }
psy_vm = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_vm", default-features = false }
psy_crypto = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_crypto" }
psy_data = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_client_data", default-features = false }
psy_common = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_client_common" }
psy_config = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_config" }
psy_prover = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_prover", default-features = false }
psy_provider = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_provider" }
psy_common_circuit = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_common_circuit", default-features = false }
psy_dpn_circuit = { git = "ssh://git@github.com/QEDProtocol/parth-generic-v1.git", rev = "1de704feed5a4b74e6bc046bcbeff630fcac9789", package = "psy_dpn_circuit", default-features = false }

base64 = "0.22"
bincode = { version = "=1.3.3" }
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
PSY_COMPILER_WASM_WORKSPACE ?= ../parth-generic-v1/client_prover/psy_ide
PSY_COMPILER_WASM_CRATE ?= psy_wasm

check:
@cargo check --workspace --all-targets --tests --benches --examples --bins
@cd psy-ts-sdk/packages/psy-sdk && pnpm install && pnpm type-check
Expand All @@ -10,5 +13,5 @@ build:
wasm-build:
@cd psy-rust-sdk && wasm-pack build --target web --out-dir ../psy-ts-sdk/packages/psy-sdk/src/local-web-prover --out-name psy_prover --no-pack --release
@cp .github/templates/.gitignore.wasm ./psy-ts-sdk/packages/psy-sdk/src/local-web-prover/.gitignore
@cd ../psy-compiler && wasm-pack build psy-wasm --target web --out-dir $(PWD)/psy-ts-sdk/packages/psy-sdk/src/local-web-compiler --out-name psy_compiler --no-pack --release
@cd $(PSY_COMPILER_WASM_WORKSPACE) && wasm-pack build $(PSY_COMPILER_WASM_CRATE) --target web --out-dir $(PWD)/psy-ts-sdk/packages/psy-sdk/src/local-web-compiler --out-name psy_compiler --no-pack --release
@cp .github/templates/.gitignore.wasm ./psy-ts-sdk/packages/psy-sdk/src/local-web-compiler/.gitignore
2 changes: 2 additions & 0 deletions psy-ts-sdk/packages/contract-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ export { AbiConverter } from "./converters/abi-converter";

// Export runtime module
export { Contract } from "./runtime/contract";
export { deployContractWithAbi } from "./runtime/deploy";
export { Signer } from "./runtime/types";
export type { Felt, ISigner, PsyFixedArray, ContractOptions } from "./runtime";
export type { DeployContractWithAbiOptions, DeployContractWithAbiResult } from "./runtime/deploy";

// Only try to export generated files if they exist
// This allows the package to build even before generation
Expand Down
44 changes: 44 additions & 0 deletions psy-ts-sdk/packages/contract-sdk/src/runtime/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
DPNFunctionCircuitDefinition,
IPsyUserProverProvider,
QBCDeployContract,
uploadPendingContractAbi,
} from "@psy/psy-sdk";

export interface DeployContractWithAbiOptions {
prover: IPsyUserProverProvider;
deployer: string;
circuitDefinitions: DPNFunctionCircuitDefinition[];
servicesUrl: string;
abi: unknown;
metadata?: Record<string, unknown>;
}

export interface DeployContractWithAbiResult {
deployHash: string;
deployContract: QBCDeployContract;
}

export async function deployContractWithAbi({
prover,
deployer,
circuitDefinitions,
servicesUrl,
abi,
metadata,
}: DeployContractWithAbiOptions): Promise<DeployContractWithAbiResult> {
const deployContract = await prover.getDeployContractCmd(deployer, circuitDefinitions);
await uploadPendingContractAbi(servicesUrl, {
deployContract,
abi,
metadata,
deployer,
});
const deployHash = prover.submitDeployContractCmd
? await prover.submitDeployContractCmd(deployContract)
: await prover.deployContract(deployer, circuitDefinitions);
return {
deployHash,
deployContract,
};
}
Loading