From e412a1ce1df8b4d179e6343d77a73ad3681cab4d Mon Sep 17 00:00:00 2001 From: Prathmesh Khandelwal <201952225@iiitvadodara.ac.in> Date: Thu, 27 Jul 2023 19:25:45 +0530 Subject: [PATCH 1/8] fix: provider passing in options --- packages/agents/sdk-wrapper/src/sdkPool.ts | 114 ++++++++++++------ packages/agents/sdk-wrapper/src/sdkShared.ts | 13 +- .../agents/sdk-wrapper/test/sdkPool.spec.ts | 27 ++--- .../agents/sdk-wrapper/test/sdkShared.spec.ts | 5 +- 4 files changed, 100 insertions(+), 59 deletions(-) diff --git a/packages/agents/sdk-wrapper/src/sdkPool.ts b/packages/agents/sdk-wrapper/src/sdkPool.ts index 188c503c33..b918990b7a 100644 --- a/packages/agents/sdk-wrapper/src/sdkPool.ts +++ b/packages/agents/sdk-wrapper/src/sdkPool.ts @@ -39,10 +39,14 @@ export class SdkPool extends SdkShared { amount: BigNumberish, options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, tokenAddress, @@ -177,10 +181,14 @@ export class SdkPool extends SdkShared { isDeposit = true, options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, tokenAddress, @@ -199,10 +207,14 @@ export class SdkPool extends SdkShared { amount: string, options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, tokenAddress, @@ -221,10 +233,14 @@ export class SdkPool extends SdkShared { index: number, options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, tokenAddress, @@ -262,7 +278,16 @@ export class SdkPool extends SdkShared { tokenAddress: string, amountX: string, amountY: string, + options?: Options, ): Promise { + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params: { domainId: string; tokenAddress: string; amountX: string; amountY: string } = { domainId, tokenAddress, @@ -279,7 +304,15 @@ export class SdkPool extends SdkShared { tokenAddress: string, amountX: string, amountY: string, + options?: Options, ): Promise { + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } const params: { domainId: string; tokenAddress: string; amountX: string; amountY: string } = { domainId, tokenAddress, @@ -299,8 +332,7 @@ export class SdkPool extends SdkShared { options?: Options, ): Promise { const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, + originProviderUrl: this.config.chains[domainId].providers?.[0], }; const params = { domainId, @@ -396,10 +428,14 @@ export class SdkPool extends SdkShared { _index?: number, options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, tokenAddress, @@ -423,10 +459,14 @@ export class SdkPool extends SdkShared { } async getVirtualPrice(domainId: string, tokenAddress: string, options?: Options): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, tokenAddress, @@ -554,10 +594,13 @@ export class SdkPool extends SdkShared { deadline = this.getDefaultDeadline(), options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } const params = { domainId, tokenAddress, @@ -580,10 +623,13 @@ export class SdkPool extends SdkShared { deadline = this.getDefaultDeadline(), options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } const params = { domainId, tokenAddress, diff --git a/packages/agents/sdk-wrapper/src/sdkShared.ts b/packages/agents/sdk-wrapper/src/sdkShared.ts index cc644e26c5..52985dd8e2 100644 --- a/packages/agents/sdk-wrapper/src/sdkShared.ts +++ b/packages/agents/sdk-wrapper/src/sdkShared.ts @@ -110,10 +110,15 @@ export class SdkShared { infiniteApprove?: boolean, options?: Options, ): Promise { - const _options = options ?? { - chains: this.config.chains, - signerAddress: this.config.signerAddress, - }; + + const originProviderUrl = this.config.chains[domainId]?.providers; + + const _options = options ?? {}; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl[0]; + } + const params = { domainId, assetId, diff --git a/packages/agents/sdk-wrapper/test/sdkPool.spec.ts b/packages/agents/sdk-wrapper/test/sdkPool.spec.ts index 75617e6434..a55a80355b 100644 --- a/packages/agents/sdk-wrapper/test/sdkPool.spec.ts +++ b/packages/agents/sdk-wrapper/test/sdkPool.spec.ts @@ -200,8 +200,7 @@ describe("#SDKPool", () => { tokenIndexTo: 1, amount: "100", options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -374,8 +373,7 @@ describe("#SDKPool", () => { amounts: ["100", "100"], isDeposit: true, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -451,8 +449,7 @@ describe("#SDKPool", () => { tokenAddress: mockXTransfer.origin!.assets.transacting.asset, amount: "100", options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = [ @@ -538,8 +535,7 @@ describe("#SDKPool", () => { amount: "100", index: 0, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -690,8 +686,7 @@ describe("#SDKPool", () => { tokenX: mock.asset.A.address, tokenY: mock.asset.B.address, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -1000,8 +995,7 @@ describe("#SDKPool", () => { poolTokenAddress: mockXTransfer.origin!.assets.transacting.asset, _index: 0, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -1102,8 +1096,7 @@ describe("#SDKPool", () => { domainId: mockXTransfer.xparams.originDomain, tokenAddress: mockXTransfer.origin!.assets.transacting.asset, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -1466,8 +1459,7 @@ describe("#SDKPool", () => { maxBurnAmount: "0", deadline: 100000, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -1540,8 +1532,7 @@ describe("#SDKPool", () => { minDy: 0, deadline: 100000, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; diff --git a/packages/agents/sdk-wrapper/test/sdkShared.spec.ts b/packages/agents/sdk-wrapper/test/sdkShared.spec.ts index 57854e9bc9..3966e083e3 100644 --- a/packages/agents/sdk-wrapper/test/sdkShared.spec.ts +++ b/packages/agents/sdk-wrapper/test/sdkShared.spec.ts @@ -145,7 +145,7 @@ describe("#SDKShared", () => { status: 200, }); - const res = await sdkShared.getDeploymentAddress(expectedArgs.domainId, expectedArgs.deploymentName); + const res = await sdkShared.getDeploymentAddress(expectedArgs.domainId, expectedArgs.deploymentName as "connext"); expect(axiosGetStub).to.have.been.calledWithExactly( expectedBaseUri + expectedEndpoint + `/${expectedArgs.domainId}` + `/${expectedArgs.deploymentName}`, @@ -332,8 +332,7 @@ describe("#SDKShared", () => { amount: "100", infiniteApprove: true, options: { - chains: mockConfig.chains, - signerAddress: mockConfig.signerAddress, + originProviderUrl: mockConfig.chains[mock.domain.A].providers?.[0], }, }; From 315c8196ac1ef1f55014d7d8357670c9d23559cb Mon Sep 17 00:00:00 2001 From: Prathmesh Khandelwal <201952225@iiitvadodara.ac.in> Date: Thu, 27 Jul 2023 21:54:00 +0530 Subject: [PATCH 2/8] fix: added signers and chains --- packages/agents/sdk-wrapper/src/sdkPool.ts | 102 ++++++++++++------ packages/agents/sdk-wrapper/src/sdkShared.ts | 11 +- .../agents/sdk-wrapper/test/sdkPool.spec.ts | 18 ++++ .../agents/sdk-wrapper/test/sdkShared.spec.ts | 2 + 4 files changed, 98 insertions(+), 35 deletions(-) diff --git a/packages/agents/sdk-wrapper/src/sdkPool.ts b/packages/agents/sdk-wrapper/src/sdkPool.ts index b918990b7a..c37eb362ab 100644 --- a/packages/agents/sdk-wrapper/src/sdkPool.ts +++ b/packages/agents/sdk-wrapper/src/sdkPool.ts @@ -39,12 +39,15 @@ export class SdkPool extends SdkShared { amount: BigNumberish, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { @@ -181,12 +184,15 @@ export class SdkPool extends SdkShared { isDeposit = true, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { @@ -207,12 +213,15 @@ export class SdkPool extends SdkShared { amount: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { @@ -233,12 +242,15 @@ export class SdkPool extends SdkShared { index: number, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { @@ -280,12 +292,15 @@ export class SdkPool extends SdkShared { amountY: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params: { domainId: string; tokenAddress: string; amountX: string; amountY: string } = { @@ -306,13 +321,17 @@ export class SdkPool extends SdkShared { amountY: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } + const params: { domainId: string; tokenAddress: string; amountX: string; amountY: string } = { domainId, tokenAddress, @@ -331,9 +350,17 @@ export class SdkPool extends SdkShared { tokenY: string, options?: Options, ): Promise { + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; + const _options = options ?? { - originProviderUrl: this.config.chains[domainId].providers?.[0], + chains: this.config.chains, + signerAddress: this.config.signerAddress, }; + + if (originProviderUrl) { + _options["originProviderUrl"] = originProviderUrl; + } + const params = { domainId, amountX, @@ -428,12 +455,15 @@ export class SdkPool extends SdkShared { _index?: number, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { @@ -459,12 +489,15 @@ export class SdkPool extends SdkShared { } async getVirtualPrice(domainId: string, tokenAddress: string, options?: Options): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { @@ -594,12 +627,15 @@ export class SdkPool extends SdkShared { deadline = this.getDefaultDeadline(), options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } const params = { domainId, @@ -623,13 +659,17 @@ export class SdkPool extends SdkShared { deadline = this.getDefaultDeadline(), options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } + const params = { domainId, tokenAddress, diff --git a/packages/agents/sdk-wrapper/src/sdkShared.ts b/packages/agents/sdk-wrapper/src/sdkShared.ts index 52985dd8e2..e6a83e3c9a 100644 --- a/packages/agents/sdk-wrapper/src/sdkShared.ts +++ b/packages/agents/sdk-wrapper/src/sdkShared.ts @@ -111,14 +111,17 @@ export class SdkShared { options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers; + const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? {}; + const _options = options ?? { + chains: this.config.chains, + signerAddress: this.config.signerAddress, + }; if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl[0]; + _options["originProviderUrl"] = originProviderUrl; } - + const params = { domainId, assetId, diff --git a/packages/agents/sdk-wrapper/test/sdkPool.spec.ts b/packages/agents/sdk-wrapper/test/sdkPool.spec.ts index a55a80355b..fb447089a2 100644 --- a/packages/agents/sdk-wrapper/test/sdkPool.spec.ts +++ b/packages/agents/sdk-wrapper/test/sdkPool.spec.ts @@ -200,6 +200,8 @@ describe("#SDKPool", () => { tokenIndexTo: 1, amount: "100", options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -373,6 +375,8 @@ describe("#SDKPool", () => { amounts: ["100", "100"], isDeposit: true, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -449,6 +453,8 @@ describe("#SDKPool", () => { tokenAddress: mockXTransfer.origin!.assets.transacting.asset, amount: "100", options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -535,6 +541,8 @@ describe("#SDKPool", () => { amount: "100", index: 0, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -686,6 +694,8 @@ describe("#SDKPool", () => { tokenX: mock.asset.A.address, tokenY: mock.asset.B.address, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -995,6 +1005,8 @@ describe("#SDKPool", () => { poolTokenAddress: mockXTransfer.origin!.assets.transacting.asset, _index: 0, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -1096,6 +1108,8 @@ describe("#SDKPool", () => { domainId: mockXTransfer.xparams.originDomain, tokenAddress: mockXTransfer.origin!.assets.transacting.asset, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -1459,6 +1473,8 @@ describe("#SDKPool", () => { maxBurnAmount: "0", deadline: 100000, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -1532,6 +1548,8 @@ describe("#SDKPool", () => { minDy: 0, deadline: 100000, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; diff --git a/packages/agents/sdk-wrapper/test/sdkShared.spec.ts b/packages/agents/sdk-wrapper/test/sdkShared.spec.ts index 3966e083e3..3bd62f841f 100644 --- a/packages/agents/sdk-wrapper/test/sdkShared.spec.ts +++ b/packages/agents/sdk-wrapper/test/sdkShared.spec.ts @@ -332,6 +332,8 @@ describe("#SDKShared", () => { amount: "100", infiniteApprove: true, options: { + chains: mockConfig.chains, + signerAddress: mockConfig.signerAddress, originProviderUrl: mockConfig.chains[mock.domain.A].providers?.[0], }, }; From de8f35ef9fcbdc5e630d2fbc9e0e0ee89ae399a6 Mon Sep 17 00:00:00 2001 From: just-a-node Date: Thu, 27 Jul 2023 14:36:05 -0600 Subject: [PATCH 3/8] fix: add missing options params --- packages/agents/sdk-wrapper/src/sdkPool.ts | 76 +++---------------- packages/agents/sdk-wrapper/src/sdkShared.ts | 8 +- packages/agents/sdk/src/interfaces/index.ts | 2 + packages/agents/sdk/src/sdkPool.ts | 10 ++- .../examples/sdk-server/src/routes/shared.ts | 12 ++- 5 files changed, 32 insertions(+), 76 deletions(-) diff --git a/packages/agents/sdk-wrapper/src/sdkPool.ts b/packages/agents/sdk-wrapper/src/sdkPool.ts index c37eb362ab..f62936ee4f 100644 --- a/packages/agents/sdk-wrapper/src/sdkPool.ts +++ b/packages/agents/sdk-wrapper/src/sdkPool.ts @@ -39,17 +39,12 @@ export class SdkPool extends SdkShared { amount: BigNumberish, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, @@ -184,17 +179,12 @@ export class SdkPool extends SdkShared { isDeposit = true, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, @@ -213,17 +203,12 @@ export class SdkPool extends SdkShared { amount: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, @@ -242,17 +227,12 @@ export class SdkPool extends SdkShared { index: number, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, @@ -292,17 +272,12 @@ export class SdkPool extends SdkShared { amountY: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params: { domainId: string; tokenAddress: string; amountX: string; amountY: string } = { domainId, tokenAddress, @@ -321,17 +296,12 @@ export class SdkPool extends SdkShared { amountY: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params: { domainId: string; tokenAddress: string; amountX: string; amountY: string } = { domainId, tokenAddress, @@ -350,17 +320,12 @@ export class SdkPool extends SdkShared { tokenY: string, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, amountX, @@ -455,17 +420,12 @@ export class SdkPool extends SdkShared { _index?: number, options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, @@ -489,17 +449,12 @@ export class SdkPool extends SdkShared { } async getVirtualPrice(domainId: string, tokenAddress: string, options?: Options): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, @@ -627,16 +582,12 @@ export class SdkPool extends SdkShared { deadline = this.getDefaultDeadline(), options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } const params = { domainId, tokenAddress, @@ -659,17 +610,12 @@ export class SdkPool extends SdkShared { deadline = this.getDefaultDeadline(), options?: Options, ): Promise { - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, tokenAddress, diff --git a/packages/agents/sdk-wrapper/src/sdkShared.ts b/packages/agents/sdk-wrapper/src/sdkShared.ts index e6a83e3c9a..2339e3b837 100644 --- a/packages/agents/sdk-wrapper/src/sdkShared.ts +++ b/packages/agents/sdk-wrapper/src/sdkShared.ts @@ -110,18 +110,12 @@ export class SdkShared { infiniteApprove?: boolean, options?: Options, ): Promise { - - const originProviderUrl = this.config.chains[domainId]?.providers?.[0]; - const _options = options ?? { chains: this.config.chains, + originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; - if (originProviderUrl) { - _options["originProviderUrl"] = originProviderUrl; - } - const params = { domainId, assetId, diff --git a/packages/agents/sdk/src/interfaces/index.ts b/packages/agents/sdk/src/interfaces/index.ts index 2ba905aaee..7a530fb006 100644 --- a/packages/agents/sdk/src/interfaces/index.ts +++ b/packages/agents/sdk/src/interfaces/index.ts @@ -511,6 +511,7 @@ export const SdkCalculateAddLiquidityPriceImpactParamsSchema = Type.Object({ tokenAddress: Type.String(), amountX: Type.String(), amountY: Type.String(), + options: Type.Optional(OptionsSchema), }); export type SdkCalculateAddLiquidityPriceImpactParams = Static; @@ -520,6 +521,7 @@ export const SdkCalculateRemoveLiquidityPriceImpactParamsSchema = Type.Object({ tokenAddress: Type.String(), amountX: Type.String(), amountY: Type.String(), + options: Type.Optional(OptionsSchema), }); export type SdkCalculateRemoveLiquidityPriceImpactParams = Static< typeof SdkCalculateRemoveLiquidityPriceImpactParamsSchema diff --git a/packages/agents/sdk/src/sdkPool.ts b/packages/agents/sdk/src/sdkPool.ts index 4a9bb89d45..118a324199 100644 --- a/packages/agents/sdk/src/sdkPool.ts +++ b/packages/agents/sdk/src/sdkPool.ts @@ -481,11 +481,12 @@ export class SdkPool extends SdkShared { tokenAddress: string, amountX: string, amountY: string, + options?: Options, ): Promise { const _tokenAddress = utils.getAddress(tokenAddress); const [virtualPrice, lpTokenAmount] = await Promise.all([ - this.getVirtualPrice(domainId, _tokenAddress), + this.getVirtualPrice(domainId, _tokenAddress, options), this.calculateTokenAmount(domainId, _tokenAddress, [amountX, amountY]), ]); @@ -518,12 +519,13 @@ export class SdkPool extends SdkShared { tokenAddress: string, amountX: string, amountY: string, + options?: Options, ): Promise { const _tokenAddress = utils.getAddress(tokenAddress); const [virtualPrice, lpTokenAmount] = await Promise.all([ this.getVirtualPrice(domainId, _tokenAddress), - this.calculateTokenAmount(domainId, _tokenAddress, [amountX, amountY], false), + this.calculateTokenAmount(domainId, _tokenAddress, [amountX, amountY], false, options), ]); // Normalize to 18 decimals @@ -1133,7 +1135,9 @@ export class SdkPool extends SdkShared { this.logger.debug(`No Pool for token ${_tokenAddress} on domain ${domainId}`); } const poolData = poolDataResults[0]; // there should only be one pool - maxBurnAmount = (await this.getTokenUserBalance(domainId, String(poolData.lp_token), _signerAddress)).toString(); + maxBurnAmount = ( + await this.getTokenUserBalance(domainId, String(poolData.lp_token), _signerAddress, options) + ).toString(); } const txRequest = await connextContract.populateTransaction.removeSwapLiquidityImbalance( diff --git a/packages/examples/sdk-server/src/routes/shared.ts b/packages/examples/sdk-server/src/routes/shared.ts index e466600dc0..f3026bd211 100644 --- a/packages/examples/sdk-server/src/routes/shared.ts +++ b/packages/examples/sdk-server/src/routes/shared.ts @@ -43,7 +43,7 @@ import { SdkGetCanonicalTokenIdParams, Options, } from "@connext/sdk-core"; -import { createLoggingContext, jsonifyError } from "@connext/nxtp-utils"; +import { createLoggingContext, jsonifyError, NxtpError } from "@connext/nxtp-utils"; import { BigNumber, providers } from "ethers"; import { RoutesOptions } from "../server"; @@ -51,6 +51,16 @@ interface SharedRoutesOptions extends RoutesOptions { sdkSharedInstance: SdkShared; } +export class ContractAddressMissing extends NxtpError { + constructor(domainId: string, which: string, context: any = {}) { + super( + `Contract address missing for ${domainId}: ${which}`, + { ...context, domainId, which }, + ContractAddressMissing.name, + ); + } +} + export const sharedRoutes = async (server: FastifyInstance, options: SharedRoutesOptions): Promise => { const s = server.withTypeProvider(); const { sdkSharedInstance, logger } = options; From 2e439a603b7a028e5a792082827a09d1cbdc8faa Mon Sep 17 00:00:00 2001 From: just-a-node Date: Thu, 27 Jul 2023 14:40:17 -0600 Subject: [PATCH 4/8] chore: rm test error --- packages/examples/sdk-server/src/routes/shared.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/packages/examples/sdk-server/src/routes/shared.ts b/packages/examples/sdk-server/src/routes/shared.ts index f3026bd211..e466600dc0 100644 --- a/packages/examples/sdk-server/src/routes/shared.ts +++ b/packages/examples/sdk-server/src/routes/shared.ts @@ -43,7 +43,7 @@ import { SdkGetCanonicalTokenIdParams, Options, } from "@connext/sdk-core"; -import { createLoggingContext, jsonifyError, NxtpError } from "@connext/nxtp-utils"; +import { createLoggingContext, jsonifyError } from "@connext/nxtp-utils"; import { BigNumber, providers } from "ethers"; import { RoutesOptions } from "../server"; @@ -51,16 +51,6 @@ interface SharedRoutesOptions extends RoutesOptions { sdkSharedInstance: SdkShared; } -export class ContractAddressMissing extends NxtpError { - constructor(domainId: string, which: string, context: any = {}) { - super( - `Contract address missing for ${domainId}: ${which}`, - { ...context, domainId, which }, - ContractAddressMissing.name, - ); - } -} - export const sharedRoutes = async (server: FastifyInstance, options: SharedRoutesOptions): Promise => { const s = server.withTypeProvider(); const { sdkSharedInstance, logger } = options; From 2110e460e6fb31c29d8d05923aff03d2c100bed7 Mon Sep 17 00:00:00 2001 From: Prathmesh Khandelwal <201952225@iiitvadodara.ac.in> Date: Fri, 28 Jul 2023 20:43:32 +0530 Subject: [PATCH 5/8] 4730 sdk latency subfix (#4736) * fix: added reading from chains * fix: added chains config in provider * added test * fix: remove console * fix: test fix * fix: added wrapper changes according to new changes --- packages/agents/sdk-wrapper/src/sdkPool.ts | 14 -------- packages/agents/sdk-wrapper/src/sdkShared.ts | 1 - .../agents/sdk-wrapper/test/sdkPool.spec.ts | 12 ------- .../agents/sdk-wrapper/test/sdkShared.spec.ts | 1 - packages/agents/sdk/src/sdkShared.ts | 32 ++++++++++++++++--- packages/agents/sdk/test/sdkShared.spec.ts | 3 ++ 6 files changed, 30 insertions(+), 33 deletions(-) diff --git a/packages/agents/sdk-wrapper/src/sdkPool.ts b/packages/agents/sdk-wrapper/src/sdkPool.ts index f62936ee4f..d0b4065c37 100644 --- a/packages/agents/sdk-wrapper/src/sdkPool.ts +++ b/packages/agents/sdk-wrapper/src/sdkPool.ts @@ -41,7 +41,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -181,7 +180,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -205,7 +203,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -229,7 +226,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -274,7 +270,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -298,7 +293,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -322,7 +316,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -359,7 +352,6 @@ export class SdkPool extends SdkShared { const _options = options ?? { chains: this.config.chains, signerAddress: this.config.signerAddress, - originProviderUrl: this.config.chains[domainId].providers?.[0], }; const params = { domainId, @@ -380,7 +372,6 @@ export class SdkPool extends SdkShared { const _options = options ?? { chains: this.config.chains, signerAddress: this.config.signerAddress, - originProviderUrl: this.config.chains[domainId].providers?.[0], }; const params = { domainId, @@ -422,7 +413,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -451,7 +441,6 @@ export class SdkPool extends SdkShared { async getVirtualPrice(domainId: string, tokenAddress: string, options?: Options): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -584,7 +573,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -612,7 +600,6 @@ export class SdkPool extends SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; @@ -665,7 +652,6 @@ export class SdkPool extends SdkShared { const _options = options ?? { chains: this.config.chains, signerAddress: this.config.signerAddress, - originProviderUrl: this.config.chains[domainId].providers?.[0], }; const params = { domainId, diff --git a/packages/agents/sdk-wrapper/src/sdkShared.ts b/packages/agents/sdk-wrapper/src/sdkShared.ts index 2339e3b837..236b7cfdbf 100644 --- a/packages/agents/sdk-wrapper/src/sdkShared.ts +++ b/packages/agents/sdk-wrapper/src/sdkShared.ts @@ -112,7 +112,6 @@ export class SdkShared { ): Promise { const _options = options ?? { chains: this.config.chains, - originProviderUrl: this.config.chains[domainId]?.providers?.[0], signerAddress: this.config.signerAddress, }; diff --git a/packages/agents/sdk-wrapper/test/sdkPool.spec.ts b/packages/agents/sdk-wrapper/test/sdkPool.spec.ts index fb447089a2..8179beff03 100644 --- a/packages/agents/sdk-wrapper/test/sdkPool.spec.ts +++ b/packages/agents/sdk-wrapper/test/sdkPool.spec.ts @@ -202,7 +202,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -377,7 +376,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -455,7 +453,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = [ @@ -543,7 +540,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -696,7 +692,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -814,7 +809,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mock.domain.A].providers?.[0], }, }; const mockServerRes = { @@ -879,7 +873,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mock.domain.A].providers?.[0], }, }; const mockServerRes = { @@ -1007,7 +1000,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -1110,7 +1102,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; const mockServerRes = { @@ -1475,7 +1466,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -1550,7 +1540,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mockXTransfer.xparams.originDomain].providers?.[0], }, }; @@ -1707,7 +1696,6 @@ describe("#SDKPool", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mock.domain.A].providers?.[0], }, }; const mockServerRes = [ diff --git a/packages/agents/sdk-wrapper/test/sdkShared.spec.ts b/packages/agents/sdk-wrapper/test/sdkShared.spec.ts index 3bd62f841f..82bb873bab 100644 --- a/packages/agents/sdk-wrapper/test/sdkShared.spec.ts +++ b/packages/agents/sdk-wrapper/test/sdkShared.spec.ts @@ -334,7 +334,6 @@ describe("#SDKShared", () => { options: { chains: mockConfig.chains, signerAddress: mockConfig.signerAddress, - originProviderUrl: mockConfig.chains[mock.domain.A].providers?.[0], }, }; diff --git a/packages/agents/sdk/src/sdkShared.ts b/packages/agents/sdk/src/sdkShared.ts index 27c082bd34..dab01546b3 100644 --- a/packages/agents/sdk/src/sdkShared.ts +++ b/packages/agents/sdk/src/sdkShared.ts @@ -131,9 +131,21 @@ export class SdkShared { const connextAddress = await this.getDeploymentAddress(domainId, "connext"); - const provider = options?.originProviderUrl - ? new providers.StaticJsonRpcProvider(options.originProviderUrl) + let providerURL = options?.originProviderUrl ?? options?.originProviderUrl; + + if (!providerURL && options?.chains) { + Object.keys(options.chains).forEach((domain) => { + if (domain !== domainId) { + return; + } + providerURL = options.chains?.[domain].providers?.[0]; + }); + } + + const provider = providerURL + ? new providers.StaticJsonRpcProvider(providerURL) : await this.getProvider(domainId); + return Connext__factory.connect(connextAddress, provider); }, { promise: true }, @@ -151,9 +163,19 @@ export class SdkShared { throw new ProviderMissing(domainId); } - const provider = options?.originProviderUrl - ? new providers.StaticJsonRpcProvider(options.originProviderUrl) - : await this.getProvider(domainId); + let providerURL = options?.originProviderUrl ?? options?.originProviderUrl; + + if (!providerURL && options?.chains) { + Object.keys(options.chains).forEach((domain) => { + if (domain !== domainId) { + return; + } + providerURL = options.chains?.[domain].providers?.[0]; + }); + } + + const provider = providerURL ? new providers.StaticJsonRpcProvider(providerURL) : await this.getProvider(domainId); + return IERC20__factory.connect(tokenAddress, provider); } diff --git a/packages/agents/sdk/test/sdkShared.spec.ts b/packages/agents/sdk/test/sdkShared.spec.ts index 4da7365cf6..79861d73ee 100644 --- a/packages/agents/sdk/test/sdkShared.spec.ts +++ b/packages/agents/sdk/test/sdkShared.spec.ts @@ -116,6 +116,9 @@ describe("SdkShared", () => { stub(sdkShared, "getProvider").resolves(undefined); const options = { originProviderUrl: "http://example.com", + chains: { + [mock.domain.A]: { providers: ["http://example.com"] }, + }, }; const res = await sdkShared.getERC20(mock.domain.A, mock.asset.A.address, options); From 96464d19f7d34d1621841fa8d0e4adb1637c01eb Mon Sep 17 00:00:00 2001 From: just-a-node Date: Fri, 28 Jul 2023 10:11:36 -0600 Subject: [PATCH 6/8] build: bump sdk core/wrapper --- packages/agents/sdk-wrapper/package.json | 4 ++-- packages/agents/sdk/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/agents/sdk-wrapper/package.json b/packages/agents/sdk-wrapper/package.json index 4157ef629f..ac5335c5d1 100644 --- a/packages/agents/sdk-wrapper/package.json +++ b/packages/agents/sdk-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk", - "version": "2.1.2-alpha.0", + "version": "2.1.2-alpha.1", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT", @@ -26,7 +26,7 @@ "isomorphic-fetch": "3.0.0" }, "devDependencies": { - "@connext/sdk-core": "workspace:*", + "@connext/sdk-core": "/Users/eddie/sdk-core.tgz", "@types/cpx": "1", "@types/isomorphic-fetch": "0.0.36", "cpx": "1.5.0", diff --git a/packages/agents/sdk/package.json b/packages/agents/sdk/package.json index 9d7f6187dc..5469ecab88 100644 --- a/packages/agents/sdk/package.json +++ b/packages/agents/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk-core", - "version": "2.1.2-alpha.0", + "version": "2.1.2-alpha.1", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT", From a52a9138044ea45009b03d71b94d1995fa8de1ce Mon Sep 17 00:00:00 2001 From: just-a-node Date: Fri, 28 Jul 2023 10:50:20 -0600 Subject: [PATCH 7/8] fix: use workspace dep --- packages/agents/sdk-wrapper/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agents/sdk-wrapper/package.json b/packages/agents/sdk-wrapper/package.json index ac5335c5d1..3f646042ac 100644 --- a/packages/agents/sdk-wrapper/package.json +++ b/packages/agents/sdk-wrapper/package.json @@ -26,7 +26,7 @@ "isomorphic-fetch": "3.0.0" }, "devDependencies": { - "@connext/sdk-core": "/Users/eddie/sdk-core.tgz", + "@connext/sdk-core": "workspace:*", "@types/cpx": "1", "@types/isomorphic-fetch": "0.0.36", "cpx": "1.5.0", From 7de42cc535d9921d7e7e4cc89a33cd13a547a512 Mon Sep 17 00:00:00 2001 From: just-a-node Date: Fri, 28 Jul 2023 11:24:48 -0600 Subject: [PATCH 8/8] build: bump to latest with changelogs --- packages/agents/sdk-wrapper/CHANGELOG.md | 4 ++++ packages/agents/sdk-wrapper/package.json | 2 +- packages/agents/sdk/CHANGELOG.md | 4 ++++ packages/agents/sdk/package.json | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/agents/sdk-wrapper/CHANGELOG.md b/packages/agents/sdk-wrapper/CHANGELOG.md index c3687b2de3..48c27d7961 100644 --- a/packages/agents/sdk-wrapper/CHANGELOG.md +++ b/packages/agents/sdk-wrapper/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next Release +## v2.1.2 + +- `options`: Passes providers from config into SDK server call + ## v2.1.2-alpha.0 - `getTokenSupply`, `getTokenUserBalance`, `getUserPools`: Correctly passes `options` to backend request and uses provider from config as default. diff --git a/packages/agents/sdk-wrapper/package.json b/packages/agents/sdk-wrapper/package.json index 3f646042ac..35d2590776 100644 --- a/packages/agents/sdk-wrapper/package.json +++ b/packages/agents/sdk-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk", - "version": "2.1.2-alpha.1", + "version": "2.1.2", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT", diff --git a/packages/agents/sdk/CHANGELOG.md b/packages/agents/sdk/CHANGELOG.md index 02e82c554c..e7f806122e 100644 --- a/packages/agents/sdk/CHANGELOG.md +++ b/packages/agents/sdk/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next Release +## v2.1.2 + +- `options`: SDK takes passed in provider + ## v2.1.2-alpha.0 - `getUserPools`: Takes `options?` param diff --git a/packages/agents/sdk/package.json b/packages/agents/sdk/package.json index 5469ecab88..a6e0afbb8d 100644 --- a/packages/agents/sdk/package.json +++ b/packages/agents/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@connext/sdk-core", - "version": "2.1.2-alpha.1", + "version": "2.1.2", "description": "Client-side package for interacting with the Connext protocol", "author": "Connext", "license": "MIT",