Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #91 from connext/89-expose-node-free-balance
Browse files Browse the repository at this point in the history
Expose collateral requested amount
  • Loading branch information
Rahul Sethuram authored Aug 31, 2020
2 parents 588b7b6 + 62eca5f commit 11ce837
Show file tree
Hide file tree
Showing 7 changed files with 14,341 additions and 4,192 deletions.
3 changes: 2 additions & 1 deletion examples/4-deposit.http
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Content-Type: application/json

{
"assetId": "0x4E72770760c011647D4873f60A3CF6cDeA896CD8",
"publicIdentifier": "indra53QJ6exujj3pQQ8BPuTDfQqBXvpyzkz8uS4fwbNMtMZKQZWuUS"
"publicIdentifier": "indra53QJ6exujj3pQQ8BPuTDfQqBXvpyzkz8uS4fwbNMtMZKQZWuUS",
"amount": "50000000000000000000"
}

###
Expand Down
2 changes: 2 additions & 0 deletions examples/9-withdraw.http
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Content-Type: application/json
"recipient": "0x098158D8B59327C5EcA50A299151D69182b36A4b"
}

###

# Withdraw 10 test tokens from client at index 1
POST http://localhost:5040/withdraw
Content-Type: application/json
Expand Down
18,482 changes: 14,298 additions & 4,184 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 35 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,48 @@
"deploy": "bash ops/deploy.sh"
},
"dependencies": {
"@connext/client": "7.3.1",
"@connext/client": "7.3.11",
"@ethersproject/abi": "5.0.1",
"@ethersproject/abstract-provider": "5.0.1",
"@ethersproject/abstract-signer": "5.0.1",
"@ethersproject/address": "5.0.1",
"@ethersproject/base64": "5.0.1",
"@ethersproject/basex": "5.0.1",
"@ethersproject/bytes": "5.0.1",
"@ethersproject/bignumber": "5.0.1",
"@ethersproject/constants": "5.0.1",
"@ethersproject/contracts": "5.0.1",
"@ethersproject/hash": "5.0.1",
"@ethersproject/hdnode": "5.0.1",
"@ethersproject/json-wallets": "5.0.1",
"@ethersproject/keccak256": "5.0.1",
"@ethersproject/logger": "5.0.2",
"@ethersproject/networks": "5.0.1",
"@ethersproject/pbkdf2": "5.0.1",
"@ethersproject/properties": "5.0.1",
"@ethersproject/providers": "5.0.4",
"@ethersproject/random": "5.0.1",
"@ethersproject/rlp": "5.0.1",
"@ethersproject/sha2": "5.0.1",
"@ethersproject/signing-key": "5.0.2",
"@ethersproject/solidity": "5.0.1",
"@ethersproject/strings": "5.0.1",
"@ethersproject/transactions": "5.0.1",
"@ethersproject/units": "5.0.1",
"@ethersproject/wallet": "5.0.1",
"@ethersproject/web": "5.0.1",
"@ethersproject/wordlists": "5.0.1",
"axios": "^0.19.2",
"core-js": "^3.6.5",
"dotenv": "^8.2.0",
"ethers": "^5.0.8",
"ethers": "5.0.7",
"fastify": "^3.2.0",
"fastify-auth": "^1.0.1",
"fastify-helmet": "^4.0.2",
"fastify-swagger": "^3.2.0",
"lodash": "^4.17.19",
"pino-pretty": "^4.0.1",
"sqlite3": "^5.0.0",
"sqlite3": "5.0.0",
"uuid": "^8.3.0"
},
"devDependencies": {
Expand All @@ -49,7 +79,7 @@
"@babel/register": "^7.10.4",
"@types/axios": "^0.14.0",
"@types/lodash": "^4.14.159",
"@types/node": "^14.0.27",
"@types/node": "14.0.27",
"@types/ws": "^7.2.6",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
Expand All @@ -64,6 +94,6 @@
"eslint-plugin-standard": "^4.0.1",
"prettier": "^2.0.5",
"ts-node": "^8.10.2",
"typescript": "^3.9.6"
"typescript": "3.9.7"
}
}
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default class Client {
params: RouteMethods.PostRequestCollateralRequestParams,
): Promise<void> {
const client = this.getClient();
await client.requestCollateral(params.assetId);
await client.requestCollateral(params.assetId, params.amount);
}

public async swap(
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export namespace RouteMethods {
};
export type PostRejectInstallResponse = MethodResults.Uninstall;

export type PostRequestCollateralRequestParams = MultiClientRequestParams & { assetId: string };
export type PostRequestCollateralRequestParams = MultiClientRequestParams & { assetId: string, amount?: string };

export type PostSwapRequestParams = MultiClientRequestParams & PublicParams.Swap;
export type PostSwapResponse = { fromAssetIdBalance: string; toAssetIdBalance: string };
Expand Down
2 changes: 2 additions & 0 deletions src/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cleanDeep } from "./helpers";
import { stringify } from "querystring";

export function getSwaggerOptions(docsHost: string, version: string) {
return {
Expand Down Expand Up @@ -742,6 +743,7 @@ export const getRoutes = (authHandler: any, legacyMode: boolean): any =>
type: "object",
properties: {
assetId: { type: "string" },
amount: { type: "string", nullable: true },
},
},
response: {
Expand Down

0 comments on commit 11ce837

Please sign in to comment.