Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSSDK: redesign the contract query arguments orders, security updates, docs #1273

Merged
merged 23 commits into from
Jul 11, 2023

Conversation

Leechael
Copy link
Contributor

This PR propose to continue evolving the design for JS-SDK.

  1. For queries PinkContractPromise, we unified it as options in the next. This is a breaking change. Checkout follow up code snippet:
const cert = await Phala.signCertificate({ signer, api })

// Before
await contractPromise.query.getTotalBadges(address, cert)

// After
await contractPromise.query.getTotalBadges(address, { cert })
  1. A small design learned from Acala.js:
import { ApiPromise } from '@polkadot/api';
import { WsProvider } from '@polkadot/rpc-provider';
import { options } from '@phala/sdk';

async function main() {
    const provider = new WsProvider('wss://phala.api.onfinality.io/public-ws');
    const api = new ApiPromise(options({ provider }));
    await api.isReady;

    // use api
}
  1. Cluster object

We haven't handle the situation when no cluster has been registered on chain. Also, we haven't organize cluster information well, so we try to address that as well.

  1. More test cases

A nice to have goal that add more test cases.

@Leechael Leechael self-assigned this May 21, 2023
@Leechael Leechael force-pushed the imp-jssdk-api-design branch 3 times, most recently from cf6a757 to 5cc97e7 Compare June 13, 2023 10:33
@Leechael Leechael marked this pull request as ready for review July 11, 2023 06:41
@Leechael Leechael changed the title Improve JS-SDK API Design for cluster JSSDK: redesign the contract query arguments orders, security updates, docs Jul 11, 2023
@Leechael Leechael merged commit a1fae2e into master Jul 11, 2023
8 checks passed
@Leechael Leechael deleted the imp-jssdk-api-design branch July 11, 2023 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant