Skip to content

Commit 81dc875

Browse files
[GMS-1083] Add contract clients (#94)
* add contract clients * update publish action * use npm ci --------- Co-authored-by: Allan Almeida <[email protected]>
1 parent 7c1114e commit 81dc875

File tree

10 files changed

+1238
-17
lines changed

10 files changed

+1238
-17
lines changed

.github/workflows/publish.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ jobs:
4646
tmp=$(mktemp)
4747
jq '.version = "${{ steps.clean-tag.outputs.TAG }}"' ./package.json > "$tmp" && mv "$tmp" ./package.json
4848
49+
- name: Install dependencies
50+
run: |
51+
npm ci
52+
53+
- name: Compile contracts
54+
run: |
55+
npm run compile
56+
57+
- name: Build dist files
58+
run: |
59+
rm -rf dist && npm run build
60+
4961
- name: Publish package
5062
uses: JS-DevTools/npm-publish@v1
5163
with:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ typechain
66
typechain-types
77
node.json
88

9-
#Hardhat files
9+
# Hardhat files
1010
cache
1111
artifacts
12+
13+
# Build files
14+
dist/

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
zkEVM Contracts is a library of smart contracts targeted at developers who wish to quickly build and deploy their smart contracts on the Immutable zkEVM, a general-purpose permissionless L2 zero-knowledge rollup. The library allows developers to build on contracts curated by Immutable, including (but not limited to):
66

7-
* Token presets, e.g. ERC721
7+
- Token presets, e.g. ERC721
88

9-
* Bridging contracts
9+
- Bridging contracts
1010

11-
* Marketplace and AMM contracts
11+
- Marketplace and AMM contracts
1212

13-
* Smart Contract Wallets
13+
- Smart Contract Wallets
1414

1515
These contracts are feature-rich and are the recommended standard on Immutable zkEVM intended for all users and partners within the ecosystem.
1616

@@ -23,6 +23,9 @@ $ npm install @imtbl/zkevm-contracts
2323
```
2424

2525
### Usage
26+
27+
#### Contracts
28+
2629
Once the `zkevm-contracts` package is installed, use the contracts from the library by importing them:
2730

2831
```solidity
@@ -54,11 +57,30 @@ contract MyERC721 is ImmutableERC721 {
5457
}
5558
```
5659

60+
#### SDK client
61+
62+
`zkevm-contracts` comes with a Typescript SDK client that can be used to interface with Immutable preset contracts:
63+
64+
- ImmutableERC721
65+
- ImmutableERC721MintByID
66+
67+
To import and use the ImmutableERC721 contract client:
68+
69+
```typescript
70+
import { ERC721Client } from "@imtbl/zkevm-contracts";
71+
72+
const contractAddress = YOUR_CONTRACT_ADDRESS;
73+
74+
const client = new ERC721Client(contractAddress);
75+
76+
const mintTransaction = await client.populateMint(receiver, 1);
77+
const tx = await signer.sendTransaction(mintTransaction);
78+
```
79+
5780
## Contribution
5881

5982
We aim to build robust and feature-rich standards to help all developers onboard and build their projects on Immuable zkEVM, and we welcome any and all feedback and contributions to this repository! See our [contribution guideline](CONTRIBUTING.md) for more details on opening Github issues, pull requests requesting features, minor security vulnerabilities and providing general feedback.
6083

61-
6284
## Disclaimers
6385

6486
These contracts are in an experimental stage and are subject to change without notice. The code must still be formally audited or reviewed and may have security vulnerabilities. Do not use it in production. We take no responsibility for your implementation decisions and any security problems you might experience.

0 commit comments

Comments
 (0)