Skip to content

Commit

Permalink
fix node and python sdk (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
leric7 authored May 31, 2023
1 parent 7b7171a commit cb5ea69
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 24 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/cd-python-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
make build-package
twine upload dist/* --skip-existing
make publish-package
1 change: 1 addition & 0 deletions packages/sdk/python/human-protocol-sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pip-wheel-metadata/
build
dist
*.egg-info
.eggs

# ABIs
artifacts
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/python/human-protocol-sdk/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
recursive-include contracts *
recursive-include artifacts *.json
6 changes: 5 additions & 1 deletion packages/sdk/python/human-protocol-sdk/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
clean-package:
rm -rf build artifacts dist *.egg-info
rm -rf build artifacts dist *.egg-info .eggs

build-contracts:
./scripts/build-contracts.sh
Expand Down Expand Up @@ -31,3 +31,7 @@ build-package:
make clean-package
make build-contracts
python3 setup.py sdist bdist_wheel

publish-package:
make build-package
twine upload dist/* --skip-existing
12 changes: 6 additions & 6 deletions packages/sdk/python/human-protocol-sdk/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = "*"
pylint = "*"
pytest = "*"
setuptools-pipfile = "*"

[packages]
cryptography = "*"
hmt-basemodels = "==0.1.18"
sphinx = "*"
black = "*"
pylint = "*"
pytest = "*"
web3 = "==5.24.0"
minio = "*"
validators = "*"
web3 = "==5.24.0"

[requires]
python_version = "3"
python_version = "3.10"

[pipenv]
allow_prereleases = true
9 changes: 2 additions & 7 deletions packages/sdk/python/human-protocol-sdk/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from glob import glob
import setuptools

setuptools.setup(
Expand All @@ -16,10 +15,6 @@
"Programming Language :: Python",
],
packages=setuptools.find_packages() + ["artifacts"],
install_requires=[
"boto3",
"cryptography",
"hmt-basemodels>=0.1.18",
"web3==5.24.0",
],
setup_requires="setuptools-pipfile",
use_pipfile=True,
)
4 changes: 3 additions & 1 deletion packages/sdk/typescript/human-protocol-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@human-protocol/sdk",
"description": "Human Protocol SDK",
"version": "1.0.3",
"version": "1.0.9",
"files": [
"src",
"dist"
Expand Down Expand Up @@ -38,8 +38,10 @@
"dependencies": {
"@human-protocol/core": "*",
"aws-sdk": "^2.1255.0",
"axios": "^1.4.0",
"crypto": "^1.0.1",
"ethers": "^5.7.2",
"minio": "^7.0.32",
"secp256k1": "^4.0.3",
"vitest": "^0.30.1",
"winston": "^3.8.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const NETWORKS: {
scanUrl: '',
factoryAddress: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
hmtAddress: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
stakingAddress: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
stakingAddress: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
kvstoreAddress: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707',
subgraphUrl: '',
oldSubgraphUrl: '',
Expand Down
8 changes: 6 additions & 2 deletions packages/sdk/typescript/human-protocol-sdk/src/escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ export default class EscrowClient {
)
).wait();

if (!result.events || !result.events[0] || !result.events[0].args) {
const event = result.events?.find(({ topics }) =>
topics.includes(ethers.utils.id('Launched(address,address)'))
)?.args;

if (!event) {
throw ErrorLaunchedEventIsNotEmitted;
}

return result.events[0].args[1];
return event.escrow;
} catch (e: any) {
return throwError(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ describe('EscrowClient', () => {
wait: async () => ({
events: [
{
topics: [ethers.utils.id('Launched(address,address)')],
args: {
1: expectedEscrowAddress,
escrow: expectedEscrowAddress,
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/typescript/human-protocol-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
},
"include": ["./src", "./test"]
"include": ["./src"]
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6423,7 +6423,7 @@ axios@^0.27.2:
follow-redirects "^1.14.9"
form-data "^4.0.0"

axios@^1.1.3, axios@^1.2.2, axios@^1.2.3, axios@^1.2.6, axios@^1.3.3, axios@^1.3.4:
axios@^1.1.3, axios@^1.2.2, axios@^1.2.3, axios@^1.2.6, axios@^1.3.3, axios@^1.3.4, axios@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
Expand Down

0 comments on commit cb5ea69

Please sign in to comment.