js-sdk
js-sdk copied to clipboard
Proposal/return all contracts
Description
LitContracts
package only supports ethers5 atm., and we are pretty much locked-in to this version and blockchain client. We should just return all the network contract addresses & abis; then, the developers can use whatever clients they want. However, we need to provide documentation on how to use common smart contract features, such as mintNext
for PKP, addPermittedAction
to add permitted action to a given PKP & IPFS ID, etc.
Usage
const contracts = await LitContracts.getContracts();
// for cayenne contracts
const cayennePkpNftContractAddress = contracts.cayenne.PKPNFT.address;
const cayennePkpNftContractAbi = contracts.cayenne.PKPNFT.abi;
// for manzano contracts
const manzanoRateLimitNftContractAddress = contracts.manzano.RateLimitNFT.address;
const manzanoRateLimitNftContractAbi = contracts.manzano.RateLimitNFT.abi;
// for habanero contracts
const manzanoPkpHelperContractAddress = contracts.manzano.PKPHelper.address;
const manzanoPkpHelperContractAbi = contracts.manzano.PKPHelper.abi;
Interface
export type LitContract = {
address?: string;
abi?: any;
name?: string;
};
type LitContractContext = {
[index: string]: string | any;
Allowlist: LitContract;
LITToken: LitContract;
Multisender: LitContract;
PKPHelper: LitContract;
PKPNFT: LitContract;
PKPNFTMetadata: LitContract;
PKPPermissions: LitContract;
PubkeyRouter: LitContract;
RateLimitNFT: LitContract;
Staking: LitContract;
StakingBalances: LitContract;
};
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] This change requires a documentation update
How Has This Been Tested?
Jessy jesty jest
node 'node_modules/.bin/jest' './packages/contracts-sdk/src/lib/contracts-sdk.spec.ts' -c './packages/contracts-sdk/jest.config.ts' -t 'contractsSdk should get all contracts'
Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules