Skip to content

snqre/dappnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dappnet

A safe abstract over ethers.

Server Side
(await EthereumVirtualMachine("https://polygon.llamarpc.com")
    .expect()
    .query({
        privateKey: flag(process.env?.["POLYGON_PRIVATE_KEY"]).expect("A private key is required."),
        to: "0xb33EaAd8d922B1083446DC23f610c2567fB5180f",
        signature: EthereumVirtualMachine.SignatureBuilder()
            .name("implementation")
            .external()
            .view()
            .returns("address")
            .build()
            .expect() as EthereumVirtualMachine.NonAmbientSignature
    }))
    .expect("Failed to query smart contract.")
    .parse((response): response is string => {
        return typeof response === "string";
    })
    .toResult("ERR_UNRECOGNIZED_TYPE")
    .map(response => {
        console.log("RESPONSE_RECEIVED", response);
        return;
    })
    .expect("A response was required but was either not received or was of an unexpected type.")
Client Side
(await (await (await Wallet())
    .expect("Failed to the initialize wallet.")
    .use(0n))
    .expect("Failed to pick the address.")
    .query({
        to: "0xb33EaAd8d922B1083446DC23f610c2567fB5180f",
        signature: Wallet.SignatureBuilder()
            .name("implementation")
            .external()
            .view()
            .returns("address")
            .build()
            .expect() as Wallet.NonAmbientSignature
    }))
    .expect()
    .parse((response): response is unknown => {
        return true;
    })
    .toResult(undefined)
    .map(response => {
        console.log("RESPONSE_RECEIVED", response);
        return;
    })
    .expect("A response was required but not received.");

About

A safe abstraction over ethers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published