From 65e3ead5557ed81fef6ee4a3672e382e40732a91 Mon Sep 17 00:00:00 2001 From: David Rodriguez <70919589+daveroga@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:01:59 +0200 Subject: [PATCH] Add Billions networks (#467) * add billions networks * update ubuntu version * update billions main chainid --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 2 +- chain.go | 2 ++ did.go | 6 ++++++ did_test.go | 14 ++++++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0226065..28fe214 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,7 +8,7 @@ on: jobs: lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7c10f84..66efcb2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: - 1.19.13-bullseye - 1.20.13-bullseye - 1.21.6-bookworm - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest container: golang:${{matrix.containers}} steps: - uses: actions/checkout@v3 diff --git a/chain.go b/chain.go index 37c4260..838e30a 100644 --- a/chain.go +++ b/chain.go @@ -34,6 +34,8 @@ var chainIDs = map[chainIDKey]ChainID{ {Polygon, Cardona}: 2442, {Privado, Main}: 21000, {Privado, Test}: 21001, + {Billions, Main}: 45056, + {Billions, Test}: 6913, {Linea, Main}: 59144, {Linea, Sepolia}: 59141, } diff --git a/did.go b/did.go index ecbd53d..af02fd9 100644 --- a/did.go +++ b/did.go @@ -64,6 +64,8 @@ const ( Polygon Blockchain = "polygon" // Privado is Privado blockchain network Privado Blockchain = "privado" + // Billions is Billions blockchain network + Billions Blockchain = "billions" // Linea is Linea blockchain network Linea Blockchain = "linea" // UnknownChain is used when it's not possible to retrieve blockchain type from identifier @@ -78,6 +80,7 @@ var blockchains = map[Blockchain]Blockchain{ Ethereum: Ethereum, Polygon: Polygon, Privado: Privado, + Billions: Billions, Linea: Linea, UnknownChain: UnknownChain, ReadOnly: ReadOnly, @@ -216,6 +219,9 @@ var blockchainNetworkMap = map[DIDNetworkFlag]byte{ {Blockchain: Privado, NetworkID: Main}: 0b1010_0000 | 0b0000_0001, {Blockchain: Privado, NetworkID: Test}: 0b1010_0000 | 0b0000_0010, + {Blockchain: Billions, NetworkID: Main}: 0b1011_0000 | 0b0000_0001, + {Blockchain: Billions, NetworkID: Test}: 0b1011_0000 | 0b0000_0010, + {Blockchain: Linea, NetworkID: Main}: 0b0100_0000 | 0b0000_1001, {Blockchain: Linea, NetworkID: Sepolia}: 0b0100_0000 | 0b0000_1000, } diff --git a/did_test.go b/did_test.go index da9cae4..6d20ccc 100644 --- a/did_test.go +++ b/did_test.go @@ -215,6 +215,20 @@ func TestDID_Build_From_Types(t *testing.T) { net: Test, wantDID: "did:iden3:privado:test:2Skqvp4vnSFtq5bgAXbDs1Fs4AA5QGpRut9mCDew5R", }, + { + title: "Iden3 | Billions chain, main", + method: DIDMethodIden3, + chain: Billions, + net: Main, + wantDID: "did:iden3:billions:main:2VmAkXrihYaKzzVRkb3hoFRH3zdjibHXPK2Ahm3xBq", + }, + { + title: "Iden3 | Billions chain, test", + method: DIDMethodIden3, + chain: Billions, + net: Test, + wantDID: "did:iden3:billions:test:2VxnoiNqdMPxUigcPf9LTfZdz7jSwQv8YscTjjH5zf", + }, { title: "Iden3 | Linea, Main", method: DIDMethodIden3,