A typescript library, built on top of ethers.js, for interacting with Suave confidential requests.
const provider = new SuaveProvider(kettleUrl)
const wallet = new SuaveWallet(pk, provider)
const StoreContract = new SuaveContract(storeContractAdd, storeABI, wallet)
const milkLiters = 2
const milkType = 1 // 'whole'
// Non-confidential methods are called as usual
const milkPrice = await StoreContract.milkSpotPrice(milkType)
const confidentialInputs = createPaymentBundle(milkPrice, milkLiters)
// Response is ConfidentialTransactionResponse
const res = await StoreContract.buyMilk.sendCCR(milkType, milkLiters, { confidentialInputs })
// Receipt is a normal EVM transaction receipt
const receipt = await res.wait()
const ccr = await StoreContract.buyMilk.prepareCCR(milkType, milkLiters, { confidentialInputs })
const tx = await provider.getConfidentialTransaction('0xafac2...')
const crecordlike = {
data: '0x966a0212...',
to: storeContractAdd
}
const confidentialTxResponse = await wallet.sendCCR(crecordlike, confidentialInputs)
const crecordlike = {
data: '0x966a0212...',
to: storeContractAdd
}
const crecord = await wallet.populateCRecord(crecordlike)
yarn install --dev
yarn test
Any contributions are welcome! Please submit a PR or an issue.