From 87d9dc97ca75008a3be3936f946a363f426736f4 Mon Sep 17 00:00:00 2001 From: Michael Kim Date: Wed, 30 Oct 2024 17:41:30 +0900 Subject: [PATCH] Upgrade to an extended version of the Agent feature --- .../{assistant_info.json => agent_info.json} | 0 packages/client-test/package.json | 15 +- .../client-test/scripts/02-summary/account.ts | 8 + .../client-test/scripts/02-summary/shop.ts | 9 + packages/client-test/scripts/03-shop/get.ts | 4 + .../is_provider.ts | 0 .../register_provider.ts | 3 - .../register_provider_forced.ts | 1 - .../unregister_provider_forced.ts | 24 ++ .../register_agent_provision.ts} | 11 +- .../scripts/14-agent/register_agent_refund.ts | 37 +++ .../14-agent/register_agent_withdrawal.ts | 37 +++ .../unregister_agent_provision.ts} | 7 +- .../14-agent/unregister_agent_refund.ts | 35 +++ .../14-agent/unregister_agent_withdrawal.ts | 35 +++ packages/client-test/scripts/utils/index.ts | 2 +- packages/client/package.json | 4 +- packages/client/src/interface/ILedger.ts | 25 +- packages/client/src/interfaces.ts | 50 +++- .../src/internal/client/LedgerMethods.ts | 272 +++++++++++++++--- .../client/src/internal/client/ShopMethods.ts | 22 +- packages/client/src/utils/ContractUtils.ts | 13 +- packages/client/test/history/ledger.test.ts | 1 - .../test/methods/loyalty-bridge.test.ts | 1 - .../test/methods/loyalty-transfer.test.ts | 1 - yarn.lock | 19 +- 26 files changed, 535 insertions(+), 101 deletions(-) rename packages/client-test/data/{assistant_info.json => agent_info.json} (100%) rename packages/client-test/scripts/{13-provider => 13-provision}/is_provider.ts (100%) rename packages/client-test/scripts/{13-provider => 13-provision}/register_provider.ts (84%) rename packages/client-test/scripts/{13-provider => 13-provision}/register_provider_forced.ts (96%) create mode 100644 packages/client-test/scripts/13-provision/unregister_provider_forced.ts rename packages/client-test/scripts/{13-provider/register_assistant.ts => 14-agent/register_agent_provision.ts} (73%) create mode 100644 packages/client-test/scripts/14-agent/register_agent_refund.ts create mode 100644 packages/client-test/scripts/14-agent/register_agent_withdrawal.ts rename packages/client-test/scripts/{13-provider/unregister_assistant.ts => 14-agent/unregister_agent_provision.ts} (81%) create mode 100644 packages/client-test/scripts/14-agent/unregister_agent_refund.ts create mode 100644 packages/client-test/scripts/14-agent/unregister_agent_withdrawal.ts diff --git a/packages/client-test/data/assistant_info.json b/packages/client-test/data/agent_info.json similarity index 100% rename from packages/client-test/data/assistant_info.json rename to packages/client-test/data/agent_info.json diff --git a/packages/client-test/package.json b/packages/client-test/package.json index 7a1fe46..457ee2c 100644 --- a/packages/client-test/package.json +++ b/packages/client-test/package.json @@ -44,11 +44,16 @@ "12-to_be_receive:user_total": "npx ts-node scripts/12-to_be_receve/user_total.ts", "12-to_be_receive:shop": "npx ts-node scripts/12-to_be_receve/shop.ts", "12-to_be_receive:shop_total": "npx ts-node scripts/12-to_be_receve/shop_total.ts", - "13-provider:is_provider": "npx ts-node scripts/13-provider/is_provider.ts", - "13-provider:register_provider": "npx ts-node scripts/13-provider/register_provider.ts", - "13-provider:register_assistant": "npx ts-node scripts/13-provider/register_assistant.ts", - "13-provider:unregister_assistant": "npx ts-node scripts/13-provider/unregister_assistant.ts", - "13-provider:register_provider_forced": "npx ts-node scripts/13-provider/register_provider_forced.ts" + "13-provision:is_provider": "npx ts-node scripts/13-provision/is_provider.ts", + "13-provision:register_provider": "npx ts-node scripts/13-provision/register_provider.ts", + "13-provision:register_provider_forced": "npx ts-node scripts/13-provision/register_provider_forced.ts", + "13-provision:unregister_provider_forced": "npx ts-node scripts/13-provision/unregister_provider_forced.ts", + "14-agent:register_agent_provision": "npx ts-node scripts/14-agent/register_agent_provision.ts", + "14-agent:unregister_agent_provision": "npx ts-node scripts/14-agent/unregister_agent_provision.ts", + "14-agent:register_agent_refund": "npx ts-node scripts/14-agent/register_agent_refund.ts", + "14-agent:unregister_agent_refund": "npx ts-node scripts/14-agent/unregister_agent_refund.ts", + "14-agent:register_agent_withdrawal": "npx ts-node scripts/14-agent/register_agent_withdrawal.ts", + "14-agent:unregister_agent_withdrawal": "npx ts-node scripts/14-agent/unregister_agent_withdrawal.ts" }, "directories": { "test": "test" diff --git a/packages/client-test/scripts/02-summary/account.ts b/packages/client-test/scripts/02-summary/account.ts index 8494558..e98fa2c 100644 --- a/packages/client-test/scripts/02-summary/account.ts +++ b/packages/client-test/scripts/02-summary/account.ts @@ -25,6 +25,14 @@ async function main() { console.log(` - symbol: ${summary.exchangeRate.currency.symbol}`); console.log(` - value: ${new BOACoin(summary.exchangeRate.currency.value).toDisplayString(true, 4)}`); + console.log(`- provision`); + console.log(` - enable: ${summary.provision.enable}`); + + console.log(`- agent`); + console.log(` - provision: ${summary.agent.provision}`); + console.log(` - refund: ${summary.agent.refund}`); + console.log(` - withdrawal: ${summary.agent.withdrawal}`); + console.log(`- ledger`); console.log(` - point.balance: ${new BOACoin(summary.ledger.point.balance).toDisplayString(true, 4)}`); console.log(` - point.value: ${new BOACoin(summary.ledger.point.value).toDisplayString(true, 4)}`); diff --git a/packages/client-test/scripts/02-summary/shop.ts b/packages/client-test/scripts/02-summary/shop.ts index 80cb34a..651c6c8 100644 --- a/packages/client-test/scripts/02-summary/shop.ts +++ b/packages/client-test/scripts/02-summary/shop.ts @@ -20,6 +20,7 @@ async function main() { console.log(` - delegator: ${summary.shopInfo.delegator}`); console.log(` - providedAmount: ${new BOACoin(summary.shopInfo.providedAmount).toDisplayString(true, 4)}`); console.log(` - usedAmount: ${new BOACoin(summary.shopInfo.usedAmount).toDisplayString(true, 4)}`); + console.log(` - collectedAmount: ${new BOACoin(summary.shopInfo.collectedAmount).toDisplayString(true, 4)}`); console.log(` - refundedAmount: ${new BOACoin(summary.shopInfo.refundedAmount).toDisplayString(true, 4)}`); console.log(` - refundableAmount: ${new BOACoin(summary.shopInfo.refundableAmount).toDisplayString(true, 4)}`); console.log(` - refundableToken: ${new BOACoin(summary.shopInfo.refundableToken).toDisplayString(true, 4)}`); @@ -36,6 +37,14 @@ async function main() { console.log(` - symbol: ${summary.exchangeRate.currency.symbol}`); console.log(` - value: ${new BOACoin(summary.exchangeRate.currency.value).toDisplayString(true, 4)}`); + console.log(`- settlement`); + console.log(` - manager: ${summary.settlement.manager}`); + + console.log(`- agent`); + console.log(` - provision: ${summary.agent.provision}`); + console.log(` - refund: ${summary.agent.refund}`); + console.log(` - withdrawal: ${summary.agent.withdrawal}`); + console.log(`- ledger`); console.log(` - point.balance: ${new BOACoin(summary.ledger.point.balance).toDisplayString(true, 4)}`); console.log(` - point.value: ${new BOACoin(summary.ledger.point.value).toDisplayString(true, 4)}`); diff --git a/packages/client-test/scripts/03-shop/get.ts b/packages/client-test/scripts/03-shop/get.ts index f8e3a08..b00afc4 100644 --- a/packages/client-test/scripts/03-shop/get.ts +++ b/packages/client-test/scripts/03-shop/get.ts @@ -26,7 +26,11 @@ async function main() { console.log(`delegator: ${info.delegator}`); console.log(`providedAmount: ${new BOACoin(info.providedAmount).toDisplayString(true, 2)}`); console.log(`usedAmount: ${new BOACoin(info.usedAmount).toDisplayString(true, 2)}`); + console.log(`collectedAmount: ${new BOACoin(info.collectedAmount).toDisplayString(true, 2)}`); console.log(`refundedAmount: ${new BOACoin(info.refundedAmount).toDisplayString(true, 2)}`); + + const refundable = await client.shop.getRefundableAmount(shopInfo.shopId); + console.log(`refundableAmount: ${new BOACoin(refundable.refundableAmount).toDisplayString(true, 2)}`); } main().catch((error) => { diff --git a/packages/client-test/scripts/13-provider/is_provider.ts b/packages/client-test/scripts/13-provision/is_provider.ts similarity index 100% rename from packages/client-test/scripts/13-provider/is_provider.ts rename to packages/client-test/scripts/13-provision/is_provider.ts diff --git a/packages/client-test/scripts/13-provider/register_provider.ts b/packages/client-test/scripts/13-provision/register_provider.ts similarity index 84% rename from packages/client-test/scripts/13-provider/register_provider.ts rename to packages/client-test/scripts/13-provision/register_provider.ts index 2bec509..157a51e 100644 --- a/packages/client-test/scripts/13-provider/register_provider.ts +++ b/packages/client-test/scripts/13-provision/register_provider.ts @@ -1,8 +1,5 @@ import { Helper } from "../utils"; import { Client, Context, ContextBuilder } from "acc-sdk-client-v2"; -import { BOACoin } from "../../src/Amount"; -import { Ledger, Ledger__factory } from "acc-contracts-lib-v2"; -import { Wallet } from "ethers"; async function main() { const userInfo = Helper.loadUserInfo(); diff --git a/packages/client-test/scripts/13-provider/register_provider_forced.ts b/packages/client-test/scripts/13-provision/register_provider_forced.ts similarity index 96% rename from packages/client-test/scripts/13-provider/register_provider_forced.ts rename to packages/client-test/scripts/13-provision/register_provider_forced.ts index 2e2bc8d..122e456 100644 --- a/packages/client-test/scripts/13-provider/register_provider_forced.ts +++ b/packages/client-test/scripts/13-provision/register_provider_forced.ts @@ -1,6 +1,5 @@ import { Helper } from "../utils"; import { Client, Context, ContextBuilder } from "acc-sdk-client-v2"; -import { BOACoin } from "../../src/Amount"; import { Ledger, Ledger__factory } from "acc-contracts-lib-v2"; import { Wallet } from "ethers"; diff --git a/packages/client-test/scripts/13-provision/unregister_provider_forced.ts b/packages/client-test/scripts/13-provision/unregister_provider_forced.ts new file mode 100644 index 0000000..d1bd4cc --- /dev/null +++ b/packages/client-test/scripts/13-provision/unregister_provider_forced.ts @@ -0,0 +1,24 @@ +import { Helper } from "../utils"; +import { Client, Context, ContextBuilder } from "acc-sdk-client-v2"; +import { Ledger, Ledger__factory } from "acc-contracts-lib-v2"; +import { Wallet } from "ethers"; + +async function main() { + const userInfo = Helper.loadUserInfo(); + const contextParams = ContextBuilder.buildContextParams(Helper.NETWORK, userInfo.wallet.privateKey); + if (Helper.RELAY_ENDPOINT !== "") contextParams.relayEndpoint = Helper.RELAY_ENDPOINT; + if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; + const context: Context = new Context(contextParams); + const client = new Client(context); + + const contractOwner = new Wallet(process.env.CONTRACT_OWNER || "", client.web3.getProvider()); + const ledgerContract: Ledger = Ledger__factory.connect(client.web3.getLedgerAddress(), contractOwner); + await ledgerContract.unregisterProvider(userInfo.wallet.address); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/client-test/scripts/13-provider/register_assistant.ts b/packages/client-test/scripts/14-agent/register_agent_provision.ts similarity index 73% rename from packages/client-test/scripts/13-provider/register_assistant.ts rename to packages/client-test/scripts/14-agent/register_agent_provision.ts index 9cd3671..20ab5e7 100644 --- a/packages/client-test/scripts/13-provider/register_assistant.ts +++ b/packages/client-test/scripts/14-agent/register_agent_provision.ts @@ -1,6 +1,5 @@ import { Helper } from "../utils"; import { Client, Context, ContextBuilder, NormalSteps } from "acc-sdk-client-v2"; -import { BOACoin } from "../../src/Amount"; async function main() { const userInfo = Helper.loadUserInfo(); @@ -9,10 +8,10 @@ async function main() { if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; const context: Context = new Context(contextParams); const client = new Client(context); - console.log(`client.ledger.getAssistant() : ${await client.ledger.getAssistant()}`); - const assistantInfo = Helper.loadAssistantInfo(); - console.log(`assistantInfo.wallet.address : ${assistantInfo.wallet.address}`); - for await (const step of client.ledger.registerAssistant(assistantInfo.wallet.address)) { + console.log(`client.ledger.getAgentOfProvision() : ${await client.ledger.getAgentOfProvision()}`); + const agentInfo = Helper.loadAssistantInfo(); + console.log(`agentInfo.wallet.address : ${agentInfo.wallet.address}`); + for await (const step of client.ledger.registerAgentOfProvision(agentInfo.wallet.address)) { switch (step.key) { case NormalSteps.PREPARED: console.log("NormalSteps.PREPARED"); @@ -27,7 +26,7 @@ async function main() { throw new Error("Unexpected change payable point step: " + JSON.stringify(step, null, 2)); } } - console.log(`client.ledger.getAssistant() : ${await client.ledger.getAssistant()}`); + console.log(`client.ledger.getAgentOfProvision() : ${await client.ledger.getAgentOfProvision()}`); } // We recommend this pattern to be able to use async/await everywhere diff --git a/packages/client-test/scripts/14-agent/register_agent_refund.ts b/packages/client-test/scripts/14-agent/register_agent_refund.ts new file mode 100644 index 0000000..67b1ca9 --- /dev/null +++ b/packages/client-test/scripts/14-agent/register_agent_refund.ts @@ -0,0 +1,37 @@ +import { Helper } from "../utils"; +import { Client, Context, ContextBuilder, NormalSteps } from "acc-sdk-client-v2"; + +async function main() { + const userInfo = Helper.loadUserInfo(); + const contextParams = ContextBuilder.buildContextParams(Helper.NETWORK, userInfo.wallet.privateKey); + if (Helper.RELAY_ENDPOINT !== "") contextParams.relayEndpoint = Helper.RELAY_ENDPOINT; + if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; + const context: Context = new Context(contextParams); + const client = new Client(context); + console.log(`client.ledger.getAgentOfRefund() : ${await client.ledger.getAgentOfRefund()}`); + const agentInfo = Helper.loadAssistantInfo(); + console.log(`agentInfo.wallet.address : ${agentInfo.wallet.address}`); + for await (const step of client.ledger.registerAgentOfRefund(agentInfo.wallet.address)) { + switch (step.key) { + case NormalSteps.PREPARED: + console.log("NormalSteps.PREPARED"); + break; + case NormalSteps.SENT: + console.log("NormalSteps.SENT"); + break; + case NormalSteps.DONE: + console.log("NormalSteps.DONE"); + break; + default: + throw new Error("Unexpected change payable point step: " + JSON.stringify(step, null, 2)); + } + } + console.log(`client.ledger.getAgentOfRefund() : ${await client.ledger.getAgentOfRefund()}`); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/client-test/scripts/14-agent/register_agent_withdrawal.ts b/packages/client-test/scripts/14-agent/register_agent_withdrawal.ts new file mode 100644 index 0000000..5535d2e --- /dev/null +++ b/packages/client-test/scripts/14-agent/register_agent_withdrawal.ts @@ -0,0 +1,37 @@ +import { Helper } from "../utils"; +import { Client, Context, ContextBuilder, NormalSteps } from "acc-sdk-client-v2"; + +async function main() { + const userInfo = Helper.loadUserInfo(); + const contextParams = ContextBuilder.buildContextParams(Helper.NETWORK, userInfo.wallet.privateKey); + if (Helper.RELAY_ENDPOINT !== "") contextParams.relayEndpoint = Helper.RELAY_ENDPOINT; + if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; + const context: Context = new Context(contextParams); + const client = new Client(context); + console.log(`client.ledger.getAgentOfWithdrawal() : ${await client.ledger.getAgentOfWithdrawal()}`); + const agentInfo = Helper.loadAssistantInfo(); + console.log(`agentInfo.wallet.address : ${agentInfo.wallet.address}`); + for await (const step of client.ledger.registerAgentOfWithdrawal(agentInfo.wallet.address)) { + switch (step.key) { + case NormalSteps.PREPARED: + console.log("NormalSteps.PREPARED"); + break; + case NormalSteps.SENT: + console.log("NormalSteps.SENT"); + break; + case NormalSteps.DONE: + console.log("NormalSteps.DONE"); + break; + default: + throw new Error("Unexpected change payable point step: " + JSON.stringify(step, null, 2)); + } + } + console.log(`client.ledger.getAgentOfWithdrawal() : ${await client.ledger.getAgentOfWithdrawal()}`); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/client-test/scripts/13-provider/unregister_assistant.ts b/packages/client-test/scripts/14-agent/unregister_agent_provision.ts similarity index 81% rename from packages/client-test/scripts/13-provider/unregister_assistant.ts rename to packages/client-test/scripts/14-agent/unregister_agent_provision.ts index 313b9bf..edb3255 100644 --- a/packages/client-test/scripts/13-provider/unregister_assistant.ts +++ b/packages/client-test/scripts/14-agent/unregister_agent_provision.ts @@ -1,6 +1,5 @@ import { Helper } from "../utils"; import { Client, Context, ContextBuilder, NormalSteps } from "acc-sdk-client-v2"; -import { BOACoin } from "../../src/Amount"; async function main() { const userInfo = Helper.loadUserInfo(); @@ -9,8 +8,8 @@ async function main() { if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; const context: Context = new Context(contextParams); const client = new Client(context); - console.log(`client.ledger.getAssistant() : ${await client.ledger.getAssistant()}`); - for await (const step of client.ledger.unregisterAssistant()) { + console.log(`client.ledger.getAgentOfProvision() : ${await client.ledger.getAgentOfProvision()}`); + for await (const step of client.ledger.unregisterAgentOfProvision()) { switch (step.key) { case NormalSteps.PREPARED: console.log("NormalSteps.PREPARED"); @@ -25,7 +24,7 @@ async function main() { throw new Error("Unexpected change payable point step: " + JSON.stringify(step, null, 2)); } } - console.log(`client.ledger.getAssistant() : ${await client.ledger.getAssistant()}`); + console.log(`client.ledger.getAgentOfProvision() : ${await client.ledger.getAgentOfProvision()}`); } // We recommend this pattern to be able to use async/await everywhere diff --git a/packages/client-test/scripts/14-agent/unregister_agent_refund.ts b/packages/client-test/scripts/14-agent/unregister_agent_refund.ts new file mode 100644 index 0000000..36a868f --- /dev/null +++ b/packages/client-test/scripts/14-agent/unregister_agent_refund.ts @@ -0,0 +1,35 @@ +import { Helper } from "../utils"; +import { Client, Context, ContextBuilder, NormalSteps } from "acc-sdk-client-v2"; + +async function main() { + const userInfo = Helper.loadUserInfo(); + const contextParams = ContextBuilder.buildContextParams(Helper.NETWORK, userInfo.wallet.privateKey); + if (Helper.RELAY_ENDPOINT !== "") contextParams.relayEndpoint = Helper.RELAY_ENDPOINT; + if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; + const context: Context = new Context(contextParams); + const client = new Client(context); + console.log(`client.ledger.getAgentOfRefund() : ${await client.ledger.getAgentOfRefund()}`); + for await (const step of client.ledger.unregisterAgentOfRefund()) { + switch (step.key) { + case NormalSteps.PREPARED: + console.log("NormalSteps.PREPARED"); + break; + case NormalSteps.SENT: + console.log("NormalSteps.SENT"); + break; + case NormalSteps.DONE: + console.log("NormalSteps.DONE"); + break; + default: + throw new Error("Unexpected change payable point step: " + JSON.stringify(step, null, 2)); + } + } + console.log(`client.ledger.getAgentOfRefund() : ${await client.ledger.getAgentOfRefund()}`); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/client-test/scripts/14-agent/unregister_agent_withdrawal.ts b/packages/client-test/scripts/14-agent/unregister_agent_withdrawal.ts new file mode 100644 index 0000000..3722dc1 --- /dev/null +++ b/packages/client-test/scripts/14-agent/unregister_agent_withdrawal.ts @@ -0,0 +1,35 @@ +import { Helper } from "../utils"; +import { Client, Context, ContextBuilder, NormalSteps } from "acc-sdk-client-v2"; + +async function main() { + const userInfo = Helper.loadUserInfo(); + const contextParams = ContextBuilder.buildContextParams(Helper.NETWORK, userInfo.wallet.privateKey); + if (Helper.RELAY_ENDPOINT !== "") contextParams.relayEndpoint = Helper.RELAY_ENDPOINT; + if (Helper.WEB3_ENDPOINT !== "") contextParams.web3Provider = Helper.WEB3_ENDPOINT; + const context: Context = new Context(contextParams); + const client = new Client(context); + console.log(`client.ledger.getAgentOfWithdrawal() : ${await client.ledger.getAgentOfWithdrawal()}`); + for await (const step of client.ledger.unregisterAgentOfWithdrawal()) { + switch (step.key) { + case NormalSteps.PREPARED: + console.log("NormalSteps.PREPARED"); + break; + case NormalSteps.SENT: + console.log("NormalSteps.SENT"); + break; + case NormalSteps.DONE: + console.log("NormalSteps.DONE"); + break; + default: + throw new Error("Unexpected change payable point step: " + JSON.stringify(step, null, 2)); + } + } + console.log(`client.ledger.getAgentOfWithdrawal() : ${await client.ledger.getAgentOfWithdrawal()}`); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/client-test/scripts/utils/index.ts b/packages/client-test/scripts/utils/index.ts index bba103f..3f50e91 100644 --- a/packages/client-test/scripts/utils/index.ts +++ b/packages/client-test/scripts/utils/index.ts @@ -52,7 +52,7 @@ export class Helper { const data: { phone: string; privateKey: string; - } = JSON.parse(fs.readFileSync("./data/assistant_info.json", "utf8")); + } = JSON.parse(fs.readFileSync("./data/agent_info.json", "utf8")); return { phone: data.phone, wallet: new Wallet(data.privateKey), diff --git a/packages/client/package.json b/packages/client/package.json index 47c5c9b..f93eb62 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "acc-sdk-client-v2", - "version": "2.11.0", + "version": "2.12.0", "author": "BOSagora Foundation", "license": "AGPL-3.0-or-later", "main": "dist/index.js", @@ -81,7 +81,7 @@ "@ethersproject/providers": "^5.7.0", "@ethersproject/random": "^5.7.0", "@ethersproject/wallet": "^5.7.0", - "acc-contracts-lib-v2": "~2.7.0", + "acc-contracts-lib-v2": "~2.10.0", "acc-sdk-common-v2": "~2.0.0", "google-libphonenumber": "^3.2.35", "unfetch": "~4.2.0" diff --git a/packages/client/src/interface/ILedger.ts b/packages/client/src/interface/ILedger.ts index c771bcc..cb787ab 100644 --- a/packages/client/src/interface/ILedger.ts +++ b/packages/client/src/interface/ILedger.ts @@ -18,7 +18,8 @@ import { WithdrawViaBridgeStepValue, LedgerAction, IAccountSummary, - RegisterAssistantStepValue, ISystemInfo + RegisterAgentStepValue, + ISystemInfo } from "../interfaces"; import { BigNumber } from "@ethersproject/bignumber"; import { BytesLike } from "@ethersproject/bytes"; @@ -114,13 +115,25 @@ export interface ILedgerMethods extends IClientCore { // History of Side Chain getTransferHistoryInSideChain: (account: string, pageNumber?: number, pageSize?: number) => Promise; - // Provider + // Provision isProvider: () => Promise; registerProvider: () => Promise; - registerAssistant: (assistant: string) => AsyncGenerator; - unregisterAssistant: () => AsyncGenerator; - getAssistant: () => Promise; // System - getSystemInfo:() => Promise; + getSystemInfo: () => Promise; + + // Agent - Provision + getAgentOfProvision: () => Promise; + registerAgentOfProvision: (agent: string) => AsyncGenerator; + unregisterAgentOfProvision: () => AsyncGenerator; + + // Agent - Refund + getAgentOfRefund: () => Promise; + registerAgentOfRefund: (agent: string) => AsyncGenerator; + unregisterAgentOfRefund: () => AsyncGenerator; + + // Agent - Withdrawal + getAgentOfWithdrawal: () => Promise; + registerAgentOfWithdrawal: (agent: string) => AsyncGenerator; + unregisterAgentOfWithdrawal: () => AsyncGenerator; } diff --git a/packages/client/src/interfaces.ts b/packages/client/src/interfaces.ts index 033bae3..f8b4181 100644 --- a/packages/client/src/interfaces.ts +++ b/packages/client/src/interfaces.ts @@ -386,6 +386,7 @@ export type ShopData = { providedAmount: BigNumber; // 제공된 포인트 총량 usedAmount: BigNumber; // 사용된 포인트 총량 settledAmount: BigNumber; // 사용된 포인트 - 제공된 포인트 + collectedAmount: BigNumber; // refundedAmount: BigNumber; // 정산이 완료된 포인트 총량 status: ShopStatus; }; @@ -556,18 +557,18 @@ export type WaiteBridgeStepValue = key: WaiteBridgeSteps.TIMEOUT; }; -export type RegisterAssistantStepValue = +export type RegisterAgentStepValue = | { key: NormalSteps.PREPARED; - provider: string; - assistant: string; + account: string; + agent: string; signature: BytesLike; } - | { key: NormalSteps.SENT; provider: string; assistant: string; txHash: BytesLike } + | { key: NormalSteps.SENT; account: string; agent: string; txHash: BytesLike } | { key: NormalSteps.DONE; - provider: string; - assistant: string; + account: string; + agent: string; }; export enum LedgerAction { @@ -663,15 +664,32 @@ export interface IShopInfo { delegator: string; providedAmount: BigNumber; usedAmount: BigNumber; + collectedAmount: BigNumber; refundedAmount: BigNumber; refundableAmount: BigNumber; refundableToken: BigNumber; } +export interface IProvisionInfo { + enable: boolean; +} + +export interface ISettlementInfo { + manager: string; +} + +export interface IAgentInfo { + provision: string; + refund: string; + withdrawal: string; +} + export interface IAccountSummary { account: string; tokenInfo: ITokenInfo; exchangeRate: IExchangeRate; + provision: IProvisionInfo; + agent: IAgentInfo; ledger: IBalance; mainChain: IBalance; sideChain: IBalance; @@ -682,6 +700,8 @@ export interface IShopSummary { shopInfo: IShopInfo; tokenInfo: ITokenInfo; exchangeRate: IExchangeRate; + settlement: ISettlementInfo; + agent: IAgentInfo; ledger: IBalance; mainChain: IBalance; sideChain: IBalance; @@ -691,15 +711,15 @@ export interface IShopSummary { export interface ISystemInfo { token: { symbol: string; - }, + }; point: { - precision: number, + precision: number; equivalentCurrency: string; - }, - language: string, + }; + language: string; support: { - chainBridge: boolean, - loyaltyBridge: boolean, - exchange: boolean - } -} \ No newline at end of file + chainBridge: boolean; + loyaltyBridge: boolean; + exchange: boolean; + }; +} diff --git a/packages/client/src/internal/client/LedgerMethods.ts b/packages/client/src/internal/client/LedgerMethods.ts index c1713bd..7726afa 100644 --- a/packages/client/src/internal/client/LedgerMethods.ts +++ b/packages/client/src/internal/client/LedgerMethods.ts @@ -45,7 +45,7 @@ import { WaiteBridgeSteps, LedgerAction, IAccountSummary, - RegisterAssistantStepValue, + RegisterAgentStepValue, ISystemInfo } from "../../interfaces"; import { @@ -109,6 +109,14 @@ export class LedgerMethods extends ClientCore implements ILedgerMethods { value: BigNumber.from(res.data.exchangeRate.currency.value) } }, + provision: { + enable: res.data.provision.enable + }, + agent: { + provision: res.data.agent.provision, + refund: res.data.agent.refund, + withdrawal: res.data.agent.withdrawal + }, ledger: { point: { balance: BigNumber.from(res.data.ledger.point.balance), @@ -1671,7 +1679,7 @@ export class LedgerMethods extends ClientCore implements ILedgerMethods { throw new NoProviderError(); } const provider: string = await signer.getAddress(); - const res = await Network.get(await this.relay.getEndpoint(`/v1/provider/status/${provider}`)); + const res = await Network.get(await this.relay.getEndpoint(`/v1/provision/status/${provider}`)); if (res.code !== 0) { throw new InternalServerError(res?.error?.message ?? ""); } @@ -1698,13 +1706,40 @@ export class LedgerMethods extends ClientCore implements ILedgerMethods { signature }; - const res = await Network.post(await this.relay.getEndpoint("/v1/provider/register"), param); + const res = await Network.post(await this.relay.getEndpoint("/v1/provision/register"), param); + if (res.code !== 0) { + throw new InternalServerError(res?.error?.message ?? ""); + } + } + + public async getSystemInfo(): Promise { + const res = await Network.get(await this.relay.getEndpoint(`/v1/system/info`)); + if (res.code !== 0 || res.data === undefined) { + throw new InternalServerError(res?.error?.message ?? ""); + } + + return res.data; + } + + //--- + + public async getAgentOfProvision(): Promise { + const signer = this.web3.getConnectedSigner(); + if (!signer) { + throw new NoSignerError(); + } else if (!signer.provider) { + throw new NoProviderError(); + } + const account: string = await signer.getAddress(); + const res = await Network.get(await this.relay.getEndpoint(`/v1/agent/provision/${account}`)); if (res.code !== 0) { throw new InternalServerError(res?.error?.message ?? ""); } + + return res.data.agent; } - public async *registerAssistant(assistant: string): AsyncGenerator { + public async *registerAgentOfProvision(agent: string): AsyncGenerator { const signer = this.web3.getConnectedSigner(); if (!signer) { throw new NoSignerError(); @@ -1713,38 +1748,38 @@ export class LedgerMethods extends ClientCore implements ILedgerMethods { } const ledgerContract: Ledger = Ledger__factory.connect(this.web3.getLedgerAddress(), signer); - const provider: string = await signer.getAddress(); - const nonce = await ledgerContract.nonceOf(provider); - const message = ContractUtils.getRegisterAssistanceMessage(provider, assistant, nonce, this.web3.getChainId()); + const account: string = await signer.getAddress(); + const nonce = await ledgerContract.nonceOf(account); + const message = ContractUtils.getRegisterAgentMessage(account, agent, nonce, this.web3.getChainId()); const signature = await ContractUtils.signMessage(signer, message); const param = { - provider, - assistant: assistant, + account, + agent: agent, signature }; yield { key: NormalSteps.PREPARED, - provider, - assistant: assistant, + account, + agent: agent, signature }; - const res = await Network.post(await this.relay.getEndpoint("/v1/provider/assistant/register"), param); + const res = await Network.post(await this.relay.getEndpoint("/v1/agent/provision"), param); if (res.code !== 0) { throw new InternalServerError(res?.error?.message ?? ""); } const contractTx = (await signer.provider.getTransaction(res.data.txHash)) as ContractTransaction; - yield { key: NormalSteps.SENT, txHash: res.data.txHash, provider, assistant: assistant }; + yield { key: NormalSteps.SENT, txHash: res.data.txHash, account, agent: agent }; await contractTx.wait(); - yield { key: NormalSteps.DONE, provider, assistant: assistant }; + yield { key: NormalSteps.DONE, account, agent: agent }; } - public async *unregisterAssistant(): AsyncGenerator { + public async *unregisterAgentOfProvision(): AsyncGenerator { const signer = this.web3.getConnectedSigner(); if (!signer) { throw new NoSignerError(); @@ -1753,60 +1788,229 @@ export class LedgerMethods extends ClientCore implements ILedgerMethods { } const ledgerContract: Ledger = Ledger__factory.connect(this.web3.getLedgerAddress(), signer); - const provider: string = await signer.getAddress(); - const assistant = AddressZero; - const nonce = await ledgerContract.nonceOf(provider); - const message = ContractUtils.getRegisterAssistanceMessage(provider, assistant, nonce, this.web3.getChainId()); + const account: string = await signer.getAddress(); + const agent = AddressZero; + const nonce = await ledgerContract.nonceOf(account); + const message = ContractUtils.getRegisterAgentMessage(account, agent, nonce, this.web3.getChainId()); const signature = await ContractUtils.signMessage(signer, message); const param = { - provider, - assistant, + account, + agent, signature }; yield { key: NormalSteps.PREPARED, - provider, - assistant, + account, + agent, signature }; - const res = await Network.post(await this.relay.getEndpoint("/v1/provider/assistant/register"), param); + const res = await Network.post(await this.relay.getEndpoint("/v1/agent/provision"), param); if (res.code !== 0) { throw new InternalServerError(res?.error?.message ?? ""); } const contractTx = (await signer.provider.getTransaction(res.data.txHash)) as ContractTransaction; - yield { key: NormalSteps.SENT, txHash: res.data.txHash, provider, assistant }; + yield { key: NormalSteps.SENT, txHash: res.data.txHash, account, agent }; await contractTx.wait(); - yield { key: NormalSteps.DONE, provider, assistant }; + yield { key: NormalSteps.DONE, account, agent }; } - public async getAssistant(): Promise { + public async getAgentOfRefund(): Promise { const signer = this.web3.getConnectedSigner(); if (!signer) { throw new NoSignerError(); } else if (!signer.provider) { throw new NoProviderError(); } - const provider: string = await signer.getAddress(); - const res = await Network.get(await this.relay.getEndpoint(`/v1/provider/assistant/${provider}`)); + const account: string = await signer.getAddress(); + const res = await Network.get(await this.relay.getEndpoint(`/v1/agent/refund/${account}`)); if (res.code !== 0) { throw new InternalServerError(res?.error?.message ?? ""); } - return res.data.assistant; + return res.data.agent; } - public async getSystemInfo(): Promise { - const res = await Network.get(await this.relay.getEndpoint(`/v1/system/info`)); - if (res.code !== 0 || res.data === undefined) { + public async *registerAgentOfRefund(agent: string): AsyncGenerator { + const signer = this.web3.getConnectedSigner(); + if (!signer) { + throw new NoSignerError(); + } else if (!signer.provider) { + throw new NoProviderError(); + } + + const ledgerContract: Ledger = Ledger__factory.connect(this.web3.getLedgerAddress(), signer); + const account: string = await signer.getAddress(); + const nonce = await ledgerContract.nonceOf(account); + const message = ContractUtils.getRegisterAgentMessage(account, agent, nonce, this.web3.getChainId()); + const signature = await ContractUtils.signMessage(signer, message); + + const param = { + account, + agent: agent, + signature + }; + + yield { + key: NormalSteps.PREPARED, + account, + agent: agent, + signature + }; + + const res = await Network.post(await this.relay.getEndpoint("/v1/agent/refund"), param); + if (res.code !== 0) { throw new InternalServerError(res?.error?.message ?? ""); } - return res.data; + const contractTx = (await signer.provider.getTransaction(res.data.txHash)) as ContractTransaction; + yield { key: NormalSteps.SENT, txHash: res.data.txHash, account, agent: agent }; + + await contractTx.wait(); + + yield { key: NormalSteps.DONE, account, agent: agent }; + } + + public async *unregisterAgentOfRefund(): AsyncGenerator { + const signer = this.web3.getConnectedSigner(); + if (!signer) { + throw new NoSignerError(); + } else if (!signer.provider) { + throw new NoProviderError(); + } + + const ledgerContract: Ledger = Ledger__factory.connect(this.web3.getLedgerAddress(), signer); + const account: string = await signer.getAddress(); + const agent = AddressZero; + const nonce = await ledgerContract.nonceOf(account); + const message = ContractUtils.getRegisterAgentMessage(account, agent, nonce, this.web3.getChainId()); + const signature = await ContractUtils.signMessage(signer, message); + + const param = { + account, + agent, + signature + }; + + yield { + key: NormalSteps.PREPARED, + account, + agent, + signature + }; + + const res = await Network.post(await this.relay.getEndpoint("/v1/agent/refund"), param); + if (res.code !== 0) { + throw new InternalServerError(res?.error?.message ?? ""); + } + + const contractTx = (await signer.provider.getTransaction(res.data.txHash)) as ContractTransaction; + yield { key: NormalSteps.SENT, txHash: res.data.txHash, account, agent }; + + await contractTx.wait(); + + yield { key: NormalSteps.DONE, account, agent }; + } + + public async getAgentOfWithdrawal(): Promise { + const signer = this.web3.getConnectedSigner(); + if (!signer) { + throw new NoSignerError(); + } else if (!signer.provider) { + throw new NoProviderError(); + } + const account: string = await signer.getAddress(); + const res = await Network.get(await this.relay.getEndpoint(`/v1/agent/withdrawal/${account}`)); + if (res.code !== 0) { + throw new InternalServerError(res?.error?.message ?? ""); + } + + return res.data.agent; + } + + public async *registerAgentOfWithdrawal(agent: string): AsyncGenerator { + const signer = this.web3.getConnectedSigner(); + if (!signer) { + throw new NoSignerError(); + } else if (!signer.provider) { + throw new NoProviderError(); + } + + const ledgerContract: Ledger = Ledger__factory.connect(this.web3.getLedgerAddress(), signer); + const account: string = await signer.getAddress(); + const nonce = await ledgerContract.nonceOf(account); + const message = ContractUtils.getRegisterAgentMessage(account, agent, nonce, this.web3.getChainId()); + const signature = await ContractUtils.signMessage(signer, message); + + const param = { + account, + agent: agent, + signature + }; + + yield { + key: NormalSteps.PREPARED, + account, + agent: agent, + signature + }; + + const res = await Network.post(await this.relay.getEndpoint("/v1/agent/withdrawal"), param); + if (res.code !== 0) { + throw new InternalServerError(res?.error?.message ?? ""); + } + + const contractTx = (await signer.provider.getTransaction(res.data.txHash)) as ContractTransaction; + yield { key: NormalSteps.SENT, txHash: res.data.txHash, account, agent: agent }; + + await contractTx.wait(); + + yield { key: NormalSteps.DONE, account, agent: agent }; + } + + public async *unregisterAgentOfWithdrawal(): AsyncGenerator { + const signer = this.web3.getConnectedSigner(); + if (!signer) { + throw new NoSignerError(); + } else if (!signer.provider) { + throw new NoProviderError(); + } + + const ledgerContract: Ledger = Ledger__factory.connect(this.web3.getLedgerAddress(), signer); + const account: string = await signer.getAddress(); + const agent = AddressZero; + const nonce = await ledgerContract.nonceOf(account); + const message = ContractUtils.getRegisterAgentMessage(account, agent, nonce, this.web3.getChainId()); + const signature = await ContractUtils.signMessage(signer, message); + + const param = { + account, + agent, + signature + }; + + yield { + key: NormalSteps.PREPARED, + account, + agent, + signature + }; + + const res = await Network.post(await this.relay.getEndpoint("/v1/agent/withdrawal"), param); + if (res.code !== 0) { + throw new InternalServerError(res?.error?.message ?? ""); + } + + const contractTx = (await signer.provider.getTransaction(res.data.txHash)) as ContractTransaction; + yield { key: NormalSteps.SENT, txHash: res.data.txHash, account, agent }; + + await contractTx.wait(); + + yield { key: NormalSteps.DONE, account, agent }; } } diff --git a/packages/client/src/internal/client/ShopMethods.ts b/packages/client/src/internal/client/ShopMethods.ts index 88e1d53..79f8607 100644 --- a/packages/client/src/internal/client/ShopMethods.ts +++ b/packages/client/src/internal/client/ShopMethods.ts @@ -57,8 +57,8 @@ export class ShopMethods extends ClientCore implements IShopMethods { const shopContract: Shop = Shop__factory.connect(this.web3.getShopAddress(), provider); const shopInfo = await shopContract.shopOf(shopId); - const settledAmount = shopInfo.usedAmount.gt(shopInfo.providedAmount) - ? shopInfo.usedAmount.sub(shopInfo.providedAmount) + const settledAmount = shopInfo.collectedAmount.add(shopInfo.usedAmount).gt(shopInfo.providedAmount) + ? shopInfo.collectedAmount.add(shopInfo.usedAmount).sub(shopInfo.providedAmount) : BigNumber.from(0); return { shopId: shopInfo.shopId, @@ -68,6 +68,7 @@ export class ShopMethods extends ClientCore implements IShopMethods { delegator: shopInfo.delegator, providedAmount: shopInfo.providedAmount, usedAmount: shopInfo.usedAmount, + collectedAmount: shopInfo.collectedAmount, settledAmount, refundedAmount: shopInfo.refundedAmount, status: shopInfo.status @@ -90,6 +91,7 @@ export class ShopMethods extends ClientCore implements IShopMethods { delegator: res.data.shopInfo.delegator, providedAmount: BigNumber.from(res.data.shopInfo.providedAmount), usedAmount: BigNumber.from(res.data.shopInfo.usedAmount), + collectedAmount: BigNumber.from(res.data.shopInfo.collectedAmount), refundedAmount: BigNumber.from(res.data.shopInfo.refundedAmount), refundableAmount: BigNumber.from(res.data.shopInfo.refundableAmount), refundableToken: BigNumber.from(res.data.shopInfo.refundableToken) @@ -109,6 +111,14 @@ export class ShopMethods extends ClientCore implements IShopMethods { value: BigNumber.from(res.data.exchangeRate.currency.value) } }, + settlement: { + manager: res.data.settlement.manager + }, + agent: { + provision: res.data.agent.provision, + refund: res.data.agent.refund, + withdrawal: res.data.agent.withdrawal + }, ledger: { point: { balance: BigNumber.from(res.data.ledger.point.balance), @@ -455,13 +465,7 @@ export class ShopMethods extends ClientCore implements IShopMethods { const account: string = await signer.getAddress(); const adjustedAmount = ContractUtils.zeroGWEI(amount); const nonce = await shopContract.nonceOf(account); - const message = ContractUtils.getShopRefundMessage( - shopId, - account, - adjustedAmount, - nonce, - this.web3.getChainId() - ); + const message = ContractUtils.getShopRefundMessage(shopId, adjustedAmount, nonce, this.web3.getChainId()); const signature = await ContractUtils.signMessage(signer, message); const param = { diff --git a/packages/client/src/utils/ContractUtils.ts b/packages/client/src/utils/ContractUtils.ts index 88bcc82..cb55f57 100644 --- a/packages/client/src/utils/ContractUtils.ts +++ b/packages/client/src/utils/ContractUtils.ts @@ -158,14 +158,13 @@ export class ContractUtils { public static getShopRefundMessage( shopId: BytesLike, - account: string, amount: BigNumberish, nonce: BigNumberish, chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( - ["bytes32", "address", "uint256", "uint256", "uint256"], - [shopId, account, amount, chainId, nonce] + ["bytes32", "uint256", "uint256", "uint256"], + [shopId, amount, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -596,15 +595,15 @@ export class ContractUtils { return arrayify(keccak256(encodedResult)); } - public static getRegisterAssistanceMessage( - provider: string, - assistance: string, + public static getRegisterAgentMessage( + account: string, + agent: string, nonce: BigNumberish, chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["address", "address", "uint256", "uint256"], - [provider, assistance, chainId, nonce] + [account, agent, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } diff --git a/packages/client/test/history/ledger.test.ts b/packages/client/test/history/ledger.test.ts index 3db55b3..f79d393 100644 --- a/packages/client/test/history/ledger.test.ts +++ b/packages/client/test/history/ledger.test.ts @@ -1,5 +1,4 @@ import { Client, Context, ContractUtils, LedgerAction } from "../../src"; -import { Wallet } from "@ethersproject/wallet"; // @ts-ignore import fs from "fs"; diff --git a/packages/client/test/methods/loyalty-bridge.test.ts b/packages/client/test/methods/loyalty-bridge.test.ts index 1a63b52..097d21f 100644 --- a/packages/client/test/methods/loyalty-bridge.test.ts +++ b/packages/client/test/methods/loyalty-bridge.test.ts @@ -2,7 +2,6 @@ import { AccountIndex, NodeInfo } from "../helper/NodeInfo"; import { Amount, Client, Context, ContractUtils, NormalSteps, WaiteBridgeSteps } from "../../src"; import * as fs from "fs"; -import { Wallet } from "@ethersproject/wallet"; interface IUserData { idx: number; diff --git a/packages/client/test/methods/loyalty-transfer.test.ts b/packages/client/test/methods/loyalty-transfer.test.ts index 85ed4b2..9e47d1a 100644 --- a/packages/client/test/methods/loyalty-transfer.test.ts +++ b/packages/client/test/methods/loyalty-transfer.test.ts @@ -2,7 +2,6 @@ import { AccountIndex, NodeInfo } from "../helper/NodeInfo"; import { Amount, Client, Context, NormalSteps } from "../../src"; import * as fs from "fs"; -import { Wallet } from "@ethersproject/wallet"; interface IUserData { idx: number; diff --git a/yarn.lock b/yarn.lock index 0ad3f11..40182d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1968,10 +1968,10 @@ abbrev@^2.0.0: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf" integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ== -acc-contracts-lib-v2@~2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/acc-contracts-lib-v2/-/acc-contracts-lib-v2-2.7.0.tgz#e0782dec79b78d5c24fcbd1d52ffa7d1f9af3ceb" - integrity sha512-2VvtRiRdldesdccnqlv9qCvswcucNVAoWklLM4bYvVClmZv1CQoHHL8vwqFfg6uRSyypro0+Or3v2IcKRaAn9A== +acc-contracts-lib-v2@~2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/acc-contracts-lib-v2/-/acc-contracts-lib-v2-2.10.0.tgz#8dd837ae19ce058b6bdfc459fedb972db3522222" + integrity sha512-xdstm7XhHzQuWnQuPnV1Ky2pqPY3kh3qA4vChvePx2QKFAagFGaZpFGGgO8HwT+JuSNH/VLl82dCUkKPLHWm4w== dependencies: ethers "5.7.0" @@ -8297,7 +8297,7 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -8323,6 +8323,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"