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

2.4.0-rc-1 #117

Merged
merged 78 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e8210e0
adds hardhat
moshmage Aug 14, 2023
6c5b950
add proper hardhat.config.js
moshmage Aug 14, 2023
36d6580
replace compilation scripts
moshmage Aug 14, 2023
ca03a95
remove truffle workflow-compile dependency
moshmage Aug 14, 2023
f2607ff
remove custom contracts
moshmage Aug 16, 2023
8f82ed5
create a web3-type generator
moshmage Aug 16, 2023
ff6c77f
make it so generation of abi typings supports hardhat compilation as …
moshmage Aug 16, 2023
41d2f7a
removes old interface methods, remove uneeded use-model, changes sour…
moshmage Aug 18, 2023
13e7f11
testing starts
moshmage Aug 22, 2023
7d36f7c
tsc builds
moshmage Aug 22, 2023
9f9fcc2
tests run, albeit breaking
moshmage Aug 22, 2023
07f5734
web3-connection spec fixes
moshmage Aug 22, 2023
2f511ff
re-writing deploy fn
moshmage Aug 22, 2023
18ea243
fixes and fixes for e2e to properly work with web3js
moshmage Aug 28, 2023
d4fe57f
e2e passes :)
moshmage Aug 31, 2023
0633cf5
and now for all other models as well
moshmage Aug 31, 2023
c293d86
lint, package name change and version
moshmage Aug 31, 2023
5d42162
restructure contracts
moshmage Aug 31, 2023
ce01e9b
remove npm run watch from docker as it was abandoned
moshmage Aug 31, 2023
4c0ec1b
fix paths on docker-compose.yml and add npm run docs to Dockerfile
moshmage Aug 31, 2023
27429cd
add more models to README.md (missing some example usage)
moshmage Aug 31, 2023
e2fd4b1
make model loadAbi so we don't have to do that on deployjson because …
moshmage Aug 31, 2023
f35976b
link icons to correct repo
moshmage Aug 31, 2023
2db35fd
restructure test-utils folder
moshmage Aug 31, 2023
a11b52d
change .env.dist to match actual values that are used also on hardhat…
moshmage Aug 31, 2023
f34a148
more readme nudges
moshmage Aug 31, 2023
cc5fafc
link CONTRIBUTING.md to contributing how-to folder
moshmage Aug 31, 2023
3b3f0d0
more links on readme.md
moshmage Aug 31, 2023
778f051
remove v1 contracts and models
moshmage Aug 31, 2023
a159e46
clean some dead code [left behind methods and events, for next cleanup]
moshmage Aug 31, 2023
16403f2
remove dupe package list
moshmage Aug 31, 2023
d228e03
removes overrides and fixes homepage
moshmage Aug 31, 2023
49d5fcc
adds missing types
moshmage Aug 31, 2023
f8bb05f
fixes imports on contracts
moshmage Aug 31, 2023
4a10577
more import fixes
moshmage Sep 1, 2023
99f1328
try writing the keys secret to a file before starting the ci
moshmage Sep 1, 2023
70b5a5d
secretS
moshmage Sep 1, 2023
5bfbe87
... the ci wars began, i guess
moshmage Sep 1, 2023
55e4f1f
add shell: bash
moshmage Sep 1, 2023
9656e69
no quotes
moshmage Sep 1, 2023
9315f00
setup node and checkout versions to 3
moshmage Sep 1, 2023
84cd894
...cat it screw it
moshmage Sep 1, 2023
dac29c9
use mnemonic instead of trying to create keys.json -.-'
moshmage Sep 4, 2023
b983d58
mention the most common package json scripts on the how-to/contributi…
moshmage Sep 4, 2023
55214ce
remove file from yml and change getPrivateKey to work with mnemonic
moshmage Sep 4, 2023
46c4260
add cache to build and npm install, fix get-pvt-key-from-file
moshmage Sep 4, 2023
2282dfe
github.sha ?
moshmage Sep 4, 2023
ca7acd5
revert yml because hardhat doesnt like to be cached
moshmage Sep 4, 2023
aef4cdd
add secret to yml
moshmage Sep 4, 2023
d7e4963
echo the secret, just to be sure
moshmage Sep 4, 2023
0a99136
... actually echo the thing -.-'
moshmage Sep 4, 2023
8f5f34e
missing .env
moshmage Sep 4, 2023
bb1a373
default for accounts.mnemonic from hardhat
moshmage Sep 4, 2023
faa5c97
restructure the utils folder into a "models-utils" and "simple utils"
moshmage Sep 4, 2023
9ea0881
more restructuring, erc20 should use Ownable instead of Capped, clean…
moshmage Sep 11, 2023
bdc083a
we have lift off
moshmage Sep 22, 2023
00fb61d
gh action wars
moshmage Sep 22, 2023
94b159e
gh is winning
moshmage Sep 22, 2023
95aeba8
remove with and .. tomorrow..
moshmage Sep 22, 2023
d0fd432
twmp
moshmage Oct 24, 2023
96b7eaa
make registry start the token before deploying
moshmage Jan 15, 2024
00d27bd
types
moshmage Jul 2, 2024
b10cccd
add "confirmations" configuration to the web3contract
moshmage Jul 26, 2024
d03548b
lock openzepplin versions on package.json
moshmage Jul 26, 2024
767ac69
merge with master
moshmage Jul 26, 2024
d589394
update ts version and regenerate abis
moshmage Jul 26, 2024
089eac1
update node-version on gh workflow
moshmage Jul 29, 2024
a75c3ed
add environment to workflow
moshmage Jul 29, 2024
917325c
bite the bullet and write the test mnemonic on the workflow because g…
moshmage Jul 29, 2024
8615838
fix test on network registry
moshmage Jul 29, 2024
b514306
remove ipfs-wrapper
moshmage Jul 29, 2024
b1fedea
remove ipfs-wrapper interfaces
moshmage Jul 29, 2024
f1b90bc
lint
moshmage Aug 1, 2024
6331cb6
Merge pull request #115 from moshmage/2.4.0
vhcsilva Aug 22, 2024
8b15e0b
add missing dependency
vhcsilva Aug 22, 2024
4fd676a
only pass parameters to toFixed if needs to be rounded, because toFix…
vhcsilva Aug 22, 2024
a9b18b9
add default mnemonic
vhcsilva Aug 22, 2024
4c603e7
add develop branch to github actions
vhcsilva Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Tests
WEB3_HOST_PROVIDER=
WALLET_PRIVATE_KEY=

DEBUG_TESTS=
# Chain rpc to use with the tests
CI_WEB3_HOST_PROVIDER=

# Memnonic phrase (12 words) for CI to use as accounts
CI_MNEMONIC=
# If left empty, will default to hardhat default (test.... junk)
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
**/coverage/*
**/test/*
**/tooling/*
**/src/interfaces/methods/*
**/src/interfaces/generated/*
**/src/interfaces/events/*
8 changes: 5 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"parser": "@typescript-eslint/parser",
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {

"indent-legacy": ["error", 2, {
"FunctionDeclaration": {
"parameters": "first"
Expand All @@ -18,7 +17,9 @@
"camelcase": 0,
"no-underscore-dangle": 0,
"class-methods-use-this": 1,
"no-unused-vars": 1,
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_" }],
"@typescript-eslint/no-non-null-assertion": 0,
"complexity": ["error", 4],
"max-len": [
"error",
Expand All @@ -37,7 +38,8 @@
"function-call-argument-newline": [
"error",
"consistent"
]
],
"@typescript-eslint/no-explicit-any": 0
},
"env": {
"browser": true,
Expand Down
20 changes: 2 additions & 18 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
---
name: Bragging rights
about: Create a pull request to improve something for bragging rights
labels: bug, needs-triage

---

** Relates to **
<!--
A link to the original issue _or_ a clear description of what this Pull request represents
-->



<!--
NOTE: Personal pull requests are considered FOSS and will not be monetarily rewarded
You will, however, win bragging rights. While those can't buy food, they are awesome.
-->
**Describe the PR**
<!-- A clear and concise description of what the PR is -->
10 changes: 7 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.15.0]
node-version: [21.1.0]
environment: [build]
environment: build
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -35,3 +38,4 @@ jobs:
run: npm run test-ci
env:
CI: true
CI_MNEMONIC: test test test test test test test test test test test junk
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
.env
.env*
!.env.dist
.idea
xunit.xml
build/
Expand Down
10 changes: 4 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
---
noteId: "0d1b7090b1d311eb8c4ed19e49359bd0"
tags: []

---

# Contributor's Guide

Welcome; we appreciate you and would like to thank you for contributing to our project. This document aims to facilitate the process and share with you some structure that hopefully will remove any roadblock.
Expand Down Expand Up @@ -70,4 +64,8 @@ $ git commit -m "MESSAGE"
$ git push origin master
```

---

[Read on how to create models and integration tests](./how-to/contributing);

If you have any comment or ideas in terms of making this process better, please let us know or submit a PR.
8 changes: 0 additions & 8 deletions DEPENDENCIES.md

This file was deleted.

9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | b
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/v$NODE_VERSION/bin:$PATH

RUN apt-get -y update
RUN apt-get install -y g++ make python2
RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1
RUN update-alternatives --config python
RUN npm config set python python

WORKDIR /app

COPY package*.json ./
Expand All @@ -47,5 +41,4 @@ COPY . .

RUN npm run-script build

EXPOSE 9012
CMD npm run watch
RUN npm run-script docs
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ up:
down:
@docker-compose -p ${PROJECT_NAME} down

## watch - Watch and build files
watch:
@docker-compose -p ${PROJECT_NAME} up

## build - Build images.
build:
@docker-compose -p ${PROJECT_NAME} build
Expand All @@ -55,6 +51,6 @@ build:
test:
@docker-compose -p ${PROJECT_NAME} exec bepro npm run test

## ganache.start - Start ganache
ganache.start:
@docker-compose -p ${PROJECT_NAME} exec bepro npm run ganache:start
## hardhat.start - Start hardhat node
hardhat.start:
@docker-compose -p ${PROJECT_NAME} exec bepro npm run hardhat:start
86 changes: 58 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# dappkit
A javascript SDK for web3 projects with curated community contracts to ease development and interactions with blockchain contracts.

![Build Status](https://img.shields.io/github/actions/workflow/status/taikai/dappkit/integration-tests.yml)
[![GitHub issues](https://img.shields.io/github/issues/taikai/dappkit)](https://GitHub.com/taikai/dappkit/issues/)
![Build Status](https://img.shields.io/github/actions/workflow/status/layerx-labs/dappkit/integration-tests.yml)
[![GitHub issues](https://img.shields.io/github/issues/layerx-labs/dappkit)](https://GitHub.com/taikai/dappkit/issues/)
![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)
[![License](https://img.shields.io/badge/license-ISC-blue.svg)](https://opensource.org/licenses/ISC)

Expand All @@ -14,53 +14,83 @@ $ npm install @taikai/dappkit
```

## Usage
`dappkit` offers tokens ([ERC20](https://sdk.dappkit.dev/classes/ERC20.html), [ERC721](https://sdk.dappkit.dev/classes/Erc721Standard.html), [ERC1155](https://sdk.dappkit.dev/classes/ERC1155Ownable.html) and [ERC4626](https://sdk.dappkit.dev/classes/ERC4626.html)) along with some other contracts, such as [Staking](https://sdk.dappkit.dev/classes/StakingContract.html) and [Voting](https://sdk.dappkit.dev/classes/Votable.html), for ease of use. you can check all the models over at the [SDK Documentation](https://sdk.dappkit.dev/).

### Simple browser connection
```ts
import {ERC20} from '@taikai/dappkit';
import {Web3Connection} from '@layerx-labs/dappkit';

const erc20 = new ERC20({ web3Host: process.env.WEB3_HOST_PROVIDER });
const web3Connection = new Web3Connection({web3Host: 'https://rpc.tld'});
await web3Connection.connect();

console.log(`Address`, await web3Connection.getAddress());
```

await erc20.connect(); // connect web3 by asking the user to allow the connection and interact with the chain
It's possible to provide [more options](https://sdk.dappkit.dev/interfaces/Web3ConnectionOptions.html) (such as `privateKey`) to the `Web3Connection` class.
> Note: a Server side connection does not need to call `connect()` and should _when needed_ provide a `privateKey`

const tx =
await erc20Deployer.deployJsonAbi(
'Token Name', // the name of the token
'$tokenSymbol', // the symbol of the token
"1000000000000000000000000", // the total amount of the token (with 18 decimals; 1M = 1000000000000000000000000)
"0xOwnerOfErc20Address" // the owner of the total amount of the tokens (your address)
);
### Creating ERC20 tokens

await erc20.transfer('0xYourOtherAddress', 1); // transfer 1 token from your address to other address
console.log(await erc20.balanceOf('0xYourOtherAddress')) // 1
```ts
import {ERC20} from '@layerx-labs/dappkit';

const erc20 = new ERC20({ web3Host: 'http://rpc.tld' });

await erc20.deployJsonAbi(
'Token Name', // the name of the token
'$tokenSymbol', // the symbol of the token
"1000000000000000000000000", // the total amount of the token (with 18 decimals; 1M = 1000000000000000000000000)
"0xOwnerOfErc20Address" // the owner of the total amount of the tokens (your address)
);

console.log(`ERC20 address`, erc20.contractAddress);
```
> Note: Full model documentation [on the sdk](https://sdk.dappkit.dev/classes/ERC20.html)

### Just want to start a connection?
### Creating ERC721 NFTs

```ts
import {Web3Connection} from '@taikai/dappkit';
import {ERC721Collectibles} from '@layerx-labs/dappkit'

const web3Connection = new Web3Connection({web3Host: 'https://rpc.tld'});
const erc721 = new ERC721Collectibles({web3Host: 'http://rpc.tld'});

await web3Connection.connect();
await erc721.deployJsonAbi(
`Token Name`,
`$token_symbol`,
1, // how many packs can be open of this collectible (0 = infinite)
`0xAddressOfPurchasingAddress`, // address of the erc20 used to open packs
`0xBaseFeeAddress`, // address for where the main fee goes
`0xFeeAddress`, // address for where fee from purchases and pack shares
`0xAnotherAddress`); // adress for pack shares fee

console.log(`Address`, await web3Connection.getAddress());
console.log(`ERC721 address`, erc721.contractAddress)
```
> Note: Full model documentation [on the sdk](https://sdk.dappkit.dev/classes/ERC721Collectibles.html)

### Server side?
### Creating ERC1155

```ts
import {Web3Connection, Web3ConnectionOptions} from '@taikai/dappkit';
import {ERC1155Ownable} from "@layerx-labs/dappkit";

const web3ConnecitonOptions: Web3ConnectionOptions = {
web3Host: 'https://rpc.tld',
// no need to provide privateKey for read-only
privateKey: 'your-private-key', // never share your private key
}
const erc1155 = new ERC1155Ownable({web3Host: 'http://rpc.tld'});

const web3Connection = new Web3Connection(web3ConnecitonOptions);
await erc1155.deployJsonAbi('http://my.token-uri.tld/');

console.log(`Address`, await web3Connection.getAddress());
console.log(`ERC1155 address`, erc1155.contractAddress);
```
> Note: Full model documentation [on the sdk](https://sdk.dappkit.dev/classes/ERC1155Ownable.html)

### Creating ERC4626
```ts
import {ERC4626} from "@layerx-labs/dappkit";

const erc4626 = new ERC4626({web3Host: 'http://rpc.tld'})

await erc4626.deployJsonAbi(`0xUnderlyingERC20Address`, `Vault Name`, `$vault_symbol`);

console.log(`ERC4626 address `, erc4626.contractAddress);
```
> Note: Full model documentation [on the sdk](https://sdk.dappkit.dev/classes/ERC4626.html)

## Documentation

Expand Down
23 changes: 0 additions & 23 deletions contracts/ERC1155Standard.sol

This file was deleted.

49 changes: 0 additions & 49 deletions contracts/ERC20.sol

This file was deleted.

5 changes: 0 additions & 5 deletions contracts/ERC20LM.sol

This file was deleted.

Loading
Loading