Skip to content

Commit

Permalink
WIP: Multi-Backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbert Dzikowski committed Aug 18, 2023
1 parent 249a564 commit 39f838c
Show file tree
Hide file tree
Showing 107 changed files with 2,134 additions and 717 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,3 @@ dist

# TernJS port file
.tern-port

# Generated abi bindings
src/ledger/backend/ethereum/abi
src/ledger/backend/ethereum/contracts
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
"walk": "^2.3.14"
},
"dependencies": {
"@polkadot/api": "^10.9.1",
"@polkadot/api-contract": "^10.9.1",
"axios": "^0.21.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/api/responses/balanceproof.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Address } from "#erdstall/ledger";
import {
Erdstall,
Erdstall__factory,
} from "#erdstall/ledger/backend/contracts";
} from "#erdstall/ledger/backend/ethereum/contracts";

import * as test from "#erdstall/test";
import { Environment, setupEnv } from "#erdstall/test/ledger";
Expand Down
3 changes: 2 additions & 1 deletion src/api/transactions/trade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
} from "#erdstall/export/typedjson";
import { ABIEncoder, ABIPacked } from "#erdstall/api/util";
import { Signature } from "#erdstall/api";
import { Signer, utils } from "ethers";
import { utils } from "ethers";
import { Signer } from "#erdstall/ledger/backend";

@jsonObject
export class TradeFees {
Expand Down
3 changes: 2 additions & 1 deletion src/api/transactions/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import {
Serializable,
jsonBigIntMember,
} from "#erdstall/export/typedjson";
import { utils, Signer } from "ethers";
import { utils } from "ethers";
import { ETHZERO } from "#erdstall/ledger/assets";
import { Signer } from "#erdstall/ledger/backend";

const transactionImpls = new Map<string, Serializable<Transaction>>();
const transactionTypeName = "Transaction";
Expand Down
57 changes: 57 additions & 0 deletions src/client.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: Apache-2.0
"use strict";

import { ErdstallSession, ErdstallClient, Client, Session } from "#erdstall";
import { expect } from "chai";

describe("ErdstallClient", () => {
const enclaveConn = new URL("http://localhost:8080");
const cl: ErdstallClient<["ethereum", "substrate"]> = new Client<
["ethereum", "substrate"]
>(
enclaveConn,
{
backend: "ethereum",
encConn: enclaveConn,
provider: {} as any,
},
{
backend: "substrate",
arg: 420,
},
);

cl.on("Withdrawn", (e) => {});
});

describe("ErdstallSession", () => {
const singleSession: ErdstallSession<["ethereum"]> = new Session<
["ethereum"]
>({
backend: "ethereum",
encConn: new URL("http://localhost:8545"),
provider: {} as any,
signer: {} as any,
address: {} as any,
});

const _addr = singleSession.erdstall();

const multiSession = new Session<["ethereum", "substrate"]>(
{
backend: "ethereum",
encConn: new URL("http://localhost:8545"),
provider: {} as any,
signer: {} as any,
address: {} as any,
},
{
backend: "substrate",
arg: 420,
},
);

const _multiAddr = multiSession.erdstall();

singleSession.on("Withdrawn", (e) => {});
});
Loading

0 comments on commit 39f838c

Please sign in to comment.