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

Update sprint-1.14 #1449

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a60e482
wait for write on error
Hitenjain14 Mar 14, 2024
e601fd5
Merge pull request #1425 from 0chain/hotfix/wait-write
dabasov Mar 14, 2024
9e121ec
increase read and write timeout
Hitenjain14 Mar 18, 2024
7708265
Merge pull request #1430 from 0chain/hotfix/increase-timeout
dabasov Mar 18, 2024
3a65afa
Added get version
Jayashsatolia403 Mar 21, 2024
bc0662f
Debug
Jayashsatolia403 Mar 21, 2024
5385f7f
Debug
Jayashsatolia403 Mar 21, 2024
a66d15d
Fix
Jayashsatolia403 Mar 21, 2024
186f010
increase buffer size and update package
Hitenjain14 Mar 22, 2024
98b04a9
run mod tidy
Hitenjain14 Mar 22, 2024
782388b
Merge remote-tracking branch 'origin' into fix/check-mime
Hitenjain14 Mar 22, 2024
543fb9b
Merge branch 'sprint-1.14' of https://github.com/0chain/gosdk into fi…
Hitenjain14 Mar 22, 2024
da60ec4
rmv toolchain
Hitenjain14 Mar 22, 2024
cf217e0
Merge pull request #1432 from 0chain/feature/get-version
dabasov Mar 22, 2024
5e615fc
Merge branch 'staging' into fix/check-mime
dabasov Mar 22, 2024
27073d2
Merge pull request #1433 from 0chain/fix/check-mime
dabasov Mar 22, 2024
22d6439
increase timeout to 120s
Hitenjain14 Mar 24, 2024
d2c0885
Merge pull request #1436 from 0chain/hotfix/upload-timeout
dabasov Mar 24, 2024
faf22f7
clear buffer and map
Hitenjain14 Mar 24, 2024
1ca1e3b
delete key
Hitenjain14 Mar 24, 2024
4f29732
use delete instead of clear
Hitenjain14 Mar 24, 2024
c1e784e
lock and set
Hitenjain14 Mar 24, 2024
4c9e73a
set workers to 1 in wasm
Hitenjain14 Mar 25, 2024
ff968b9
Merge pull request #1438 from 0chain/hotfix/upload-worker
dabasov Mar 25, 2024
af119d5
fix release chunk
Hitenjain14 Mar 26, 2024
44cac9d
Merge branch 'staging' into hotfix/download-buffer
dabasov Mar 27, 2024
0cfe13d
Merge pull request #1439 from 0chain/hotfix/download-buffer
dabasov Mar 27, 2024
efdd2c5
Merge pull request #1437 from 0chain/hotfix/clear-map
dabasov Mar 27, 2024
f949a02
Log multi operation errors
Jayashsatolia403 Mar 27, 2024
4c6d67f
Merge pull request #1444 from 0chain/log/multioperation
dabasov Mar 27, 2024
d62a659
feature: added gas price estimation with the usage of Alchemy provider
YarikRevich Mar 15, 2024
01a27ac
feature: implemented gas amount estimation
YarikRevich Mar 27, 2024
979a43b
fix: removed dead method arguments, which were breaking the flow
YarikRevich Mar 30, 2024
05fc5f9
Merge pull request #1447 from 0chain/hotfix/gas-estimation-staging
dabasov Mar 31, 2024
ddb5823
Update go version
shahnawaz-creator Mar 23, 2024
f76f854
Update tests.yml
shahnawaz-creator Mar 23, 2024
4e12f45
updated golint version latest tests.yml
shahnawaz-creator Mar 24, 2024
404424b
updated node version
shahnawaz-creator Mar 24, 2024
c6d6186
hotfix: fixed mint signature decoding
YarikRevich Apr 2, 2024
8f34ec7
Merge branch 'staging' into hotfix/estimate-mint-wzcn
YarikRevich Apr 2, 2024
ff96e64
Merge pull request #1450 from 0chain/hotfix/estimate-mint-wzcn
dabasov Apr 2, 2024
4ecae00
fix download and mask index
Hitenjain14 Apr 3, 2024
da2bd0e
hotfix: fixed mint wzcn gas estimation decoding
YarikRevich Apr 4, 2024
f0cba37
Merge pull request #1451 from 0chain/hotfix/queue-index
dabasov Apr 4, 2024
d57a542
Merge pull request #1453 from 0chain/hotfix/mint-wzcn-estimation-sign…
dabasov Apr 4, 2024
3dfcba7
init queue after meta result
Hitenjain14 Apr 5, 2024
bf55293
Merge pull request #1454 from 0chain/hotfix/init-queue
dabasov Apr 5, 2024
edac98e
changes for benchmark
Hitenjain14 Apr 6, 2024
90a0e78
initialize buf for form
Hitenjain14 Apr 6, 2024
b5deca4
fix buf cap
Hitenjain14 Apr 6, 2024
1182da3
Merge remote-tracking branch 'origin' into feat/updown-benchmark
Hitenjain14 Apr 6, 2024
324ba50
Merge pull request #1459 from 0chain/feat/updown-benchmark
dabasov Apr 9, 2024
6e597b3
set object mimetype
Hitenjain14 Apr 10, 2024
5e6684d
Merge pull request #1463 from 0chain/hotfix/obj-mime
dabasov Apr 10, 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
16 changes: 8 additions & 8 deletions .github/workflows/build-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
go-version: 1.21.5

- name: Clean build
run: make clean-mobilesdk
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
go-version: 1.21.5

- name: Install deps
run: |
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
go-version: 1.21.5

- name: Clean build
run: make clean-mobilesdk
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
go-version: 1.21.5

- name: Install deps
run: |
Expand Down Expand Up @@ -335,10 +335,10 @@ jobs:
name: Build-wasm
runs-on: [self-hosted, arc-runner]
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v2
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.20
go-version: 1.21.5

- name: Checkout
uses: actions/checkout@v2
Expand All @@ -349,7 +349,7 @@ jobs:
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget

- name: Build
run: docker run --rm -v $PWD:/gosdk -w /gosdk golang:1.20 make wasm-build
run: docker run --rm -v $PWD:/gosdk -w /gosdk golang:1.21.5 make wasm-build

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
Expand Down
46 changes: 13 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,18 @@ jobs:
run: |
sudo apt update -y
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget

# - uses: actions/setup-go@v3
# with:
# go-version: '1.20'

- name: "Setup Go"
shell: 'script --return --quiet --command "bash {0}"'
run: |
[ -f ./https://go.dev/dl/go1.20.3.linux-amd64.tar.gz ] || wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
[ -d /usr/local/go ] && sudo rm -rf /usr/local/go
[ -f /usr/local/bin/go ] && sudo rm -rf /usr/local/bin/go
sudo tar -C /usr/local -xzf ./go1.20.3.linux-amd64.tar.gz

echo "PATH=$PATH:/usr/local/go/bin" >> $GITHUB_ENV
export PATH=$PATH:/usr/local/go/bin
which go
go env
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21.5

- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
version: v1.57.1
skip-build-cache: true
skip-pkg-cache: true
only-new-issues: true
Expand All @@ -60,18 +48,10 @@ jobs:
sudo apt update -y
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget

- name: "Setup Go"
shell: 'script --return --quiet --command "bash {0}"'
run: |
[ -f ./https://go.dev/dl/go1.20.3.linux-amd64.tar.gz ] || wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
[ -d /usr/local/go ] && sudo rm -rf /usr/local/go
[ -f /usr/local/bin/go ] && sudo rm -rf /usr/local/bin/go
sudo tar -C /usr/local -xzf ./go1.20.3.linux-amd64.tar.gz

echo "PATH=$PATH:/usr/local/go/bin" >> $GITHUB_ENV
export PATH=$PATH:/usr/local/go/bin
which go
go env
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21.5

- name: Install deps
run: |
Expand Down Expand Up @@ -252,14 +232,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup go 1.20
uses: actions/setup-go@v2
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: '1.20' # The Go version to download (if necessary) and use.
go-version: 1.21.5

- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: 20.11.1

- name: Setup PATH for wasm
run: echo "${{env.GOROOT}}/misc/wasm" >> $GITHUB_PATH
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/0chain/gosdk

go 1.20
go 1.21

require (
github.com/0chain/common v0.0.6-0.20230127095721-8df4d1d72565
Expand All @@ -13,7 +13,7 @@ require (
github.com/google/uuid v1.3.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/h2non/filetype v1.1.3
github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb
github.com/hashicorp/go-retryablehttp v0.7.2
github.com/hashicorp/golang-lru/v2 v2.0.1
github.com/herumi/bls-go-binary v1.31.0
Expand All @@ -28,7 +28,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/shopspring/decimal v1.3.1
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.4
github.com/tyler-smith/go-bip39 v1.1.0
github.com/uptrace/bunrouter v1.0.20
go.dedis.ch/kyber/v3 v3.1.0
Expand All @@ -46,7 +46,7 @@ require (
require (
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/minio/sha256-simd v1.0.1
github.com/valyala/fasthttp v1.51.0
github.com/ybbus/jsonrpc/v3 v3.1.5
)

require (
Expand Down Expand Up @@ -116,6 +116,7 @@ require (
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.dedis.ch/fixbuf v1.0.3 // indirect
go.opencensus.io v0.24.0 // indirect
Expand Down
22 changes: 13 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down Expand Up @@ -157,13 +158,15 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s=
github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
Expand Down Expand Up @@ -251,6 +254,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down Expand Up @@ -279,14 +283,15 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg=
github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb h1:GlQyMv2C48qmfPItvAXFoyN341Swxp9JNVeUZxnmbJw=
github.com/h2non/filetype v1.1.4-0.20231228185113-6469358c2bcb/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE=
github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM=
github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0=
github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand All @@ -299,12 +304,6 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/herumi/bls-go-binary v1.31.0 h1:L1goQ2tMtGgpXCg5AwHAdJQpLs/pfnWWEc3Wog6OhmI=
github.com/herumi/bls-go-binary v1.31.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y=
github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974 h1:oEjH9SSKBlzwDyYjzZaqRpxo7GlfUJCyRoOk7QHKSDs=
github.com/hitenjain14/fasthttp v0.0.0-20240201092245-8e4835c0e974/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk=
github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0 h1:XCrNCir8+zDo+Ku7B+AXhzFnsJvSelx1YbQQTNpxtqI=
github.com/hitenjain14/fasthttp v0.0.0-20240223160417-7458814cf3d0/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk=
github.com/hitenjain14/fasthttp v0.0.0-20240228200624-800f4e3a9663 h1:OS1ehSzPOz32fw+mgLL6f2dHXweh4sEB62jyLVwT7NI=
github.com/hitenjain14/fasthttp v0.0.0-20240228200624-800f4e3a9663/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk=
github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17 h1:FbyIK0BfvXVZTOxKOe2dlxJqSPSF2ZXOv2Mc7dvS7sc=
github.com/hitenjain14/fasthttp v0.0.0-20240229173600-722723e15e17/go.mod h1:RZMcXy7u4S+E97IXYTe7WHZ3+mCYOh4vys8PkIGZeXk=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
Expand Down Expand Up @@ -517,8 +516,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
Expand Down Expand Up @@ -546,6 +546,8 @@ github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6Ut
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/ybbus/jsonrpc/v3 v3.1.5 h1:0cC/QzS8OCuXYqqDbYnKKhsEe+IZLrNlDx8KPCieeW0=
github.com/ybbus/jsonrpc/v3 v3.1.5/go.mod h1:U1QbyNfL5Pvi2roT0OpRbJeyvGxfWYSgKJHjxWdAEeE=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -575,6 +577,7 @@ go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
Expand Down Expand Up @@ -827,6 +830,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=
Expand Down
69 changes: 69 additions & 0 deletions wasmsdk/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"encoding/base64"
"encoding/json"
"path"
"strconv"
Expand Down Expand Up @@ -46,6 +47,7 @@ func initBridge(
tokenAddress,
authorizersAddress,
ethereumAddress,
ethereumNodeURL,
"",
gasLimit,
consensusThreshold,
Expand Down Expand Up @@ -171,3 +173,70 @@ func getNotProcessedZCNBurnTickets() string {

return string(result)
}

// estimateBurnWZCNGasAmount performs gas amount estimation for the given burn wzcn transaction.
func estimateBurnWZCNGasAmount(from, to string, amountTokens int) string { // nolint:golint,unused
estimateBurnWZCNGasAmountResponse, err := bridge.EstimateBurnWZCNGasAmount(
context.Background(), from, to, amountTokens)
if err != nil {
return errors.Wrap("estimateBurnWZCNGasAmount", "failed to estimate gas amount", err).Error()
}

var result []byte
result, err = json.Marshal(estimateBurnWZCNGasAmountResponse)
if err != nil {
return errors.Wrap("estimateBurnWZCNGasAmount", "failed to marshal gas amount estimation result", err).Error()
}

return string(result)
}

// estimateMintWZCNGasAmount performs gas amount estimation for the given mint wzcn transaction.
func estimateMintWZCNGasAmount(from, to, zcnTransaction string, amountToken, nonce int64, signaturesRaw []string) string { // nolint:golint,unused
var signaturesBytes [][]byte

var (
signatureBytes []byte
err error
)

for _, signature := range signaturesRaw {
signatureBytes, err = base64.StdEncoding.DecodeString(signature)
if err != nil {
return errors.Wrap("estimateMintWZCNGasAmount", "failed to convert raw signature into bytes", err).Error()
}

signaturesBytes = append(signaturesBytes, signatureBytes)
}

estimateMintWZCNGasAmountResponse, err := bridge.EstimateMintWZCNGasAmount(
context.Background(), from, to, zcnTransaction, amountToken, nonce, signaturesBytes)
if err != nil {
return errors.Wrap("estimateMintWZCNGasAmount", "failed to estimate gas amount", err).Error()
}

var result []byte
result, err = json.Marshal(estimateMintWZCNGasAmountResponse)
if err != nil {
return errors.Wrap("estimateMintWZCNGasAmount", "failed to marshal gas amount estimation result", err).Error()
}

return string(result)
}

// estimateGasPrice performs gas estimation for the given transaction using Alchemy enhanced API returning
// approximate final gas fee.
func estimateGasPrice() string { // nolint:golint,unused
estimateGasPriceResponse, err := bridge.EstimateGasPrice(context.Background())
if err != nil {
return errors.Wrap("estimateGasPrice", "failed to estimate gas price", err).Error()
}

var result []byte
result, err = json.Marshal(estimateGasPriceResponse)
if err != nil {
return errors.Wrap("estimateGasPrice", "failed to marshal gas price estimation result", err).Error()
}

return string(result)
}
4 changes: 4 additions & 0 deletions wasmsdk/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func main() {
"showLogs": showLogs,
"getUSDRate": getUSDRate,
"isWalletID": isWalletID,
"getVersion": getVersion,
"getLookupHash": getLookupHash,
"createThumbnail": createThumbnail,
"makeSCRestAPICall": makeSCRestAPICall,
Expand Down Expand Up @@ -236,6 +237,9 @@ func main() {
"getMintWZCNPayload": getMintWZCNPayload,
"getNotProcessedWZCNBurnEvents": getNotProcessedWZCNBurnEvents,
"getNotProcessedZCNBurnTickets": getNotProcessedZCNBurnTickets,
"estimateBurnWZCNGasAmount": estimateBurnWZCNGasAmount,
"estimateMintWZCNGasAmount": estimateMintWZCNGasAmount,
"estimateGasPrice": estimateGasPrice,

//zcn
"getWalletBalance": getWalletBalance,
Expand Down
4 changes: 4 additions & 0 deletions wasmsdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func initSDKs(chainID, blockWorker, signatureScheme string,
return nil
}

func getVersion() string {
return sdk.GetVersion()
}

var sdkLogger *logger.Logger
var zcnLogger *logger.Logger
var logEnabled = false
Expand Down
Loading
Loading