Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wip): replace localhost
Browse files Browse the repository at this point in the history
outSH committed Nov 16, 2023
1 parent 4641342 commit 04cf2b3
Showing 144 changed files with 284 additions and 284 deletions.
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ export class CarbonAccountingApp {
}

const addressInfo = httpApi.address() as AddressInfo;
const nodeApiHost = `http://localhost:${addressInfo.port}`;
const nodeApiHost = `http://127.0.0.1:${addressInfo.port}`;

const config = new Configuration({ basePath: nodeApiHost });

Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ export async function lockBesuAssetReference(
assetRefID: string,
): Promise<void> {
await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_ASSET_REF_NAME,
invocationType: "SEND",
@@ -31,7 +31,7 @@ export async function lockBesuAssetReference(

export async function getBesuBalance(address: string): Promise<number> {
const response = await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_CBDC_ERC20_NAME,
invocationType: "CALL",
@@ -54,7 +54,7 @@ export async function isBesuAssetReference(
assetRefID: string,
): Promise<boolean> {
const response = await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_ASSET_REF_NAME,
invocationType: "CALL",
@@ -75,7 +75,7 @@ export async function isBesuAssetReference(

export async function resetBesu(): Promise<void> {
await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_CBDC_ERC20_NAME,
invocationType: "SEND",
@@ -98,7 +98,7 @@ export async function resetBesu(): Promise<void> {
);

await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_ASSET_REF_NAME,
invocationType: "SEND",
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ const FABRIC_CONTRACT_ASSET_REF_NAME = "asset-reference-contract";

export async function getFabricBalance(identity: string): Promise<number> {
const response = await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_CBDC_ERC20_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -29,7 +29,7 @@ export async function readFabricAssetReference(
assetRefID: string,
): Promise<any> {
const response = await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -50,7 +50,7 @@ export async function fabricAssetReferenceExists(
assetRefID: string,
): Promise<string> {
const response = await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -72,7 +72,7 @@ export async function lockFabricAssetReference(
assetRefID: string,
): Promise<any> {
return axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -92,7 +92,7 @@ export async function deleteFabricAssetReference(
assetRefID: string,
): Promise<any> {
return axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -113,7 +113,7 @@ export async function refundFabricTokens(
finalUserEthAddress: string,
): Promise<any> {
return axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -130,7 +130,7 @@ export async function refundFabricTokens(

export async function resetFabric(): Promise<void> {
await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_CBDC_ERC20_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -145,7 +145,7 @@ export async function resetFabric(): Promise<void> {
);

await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ Given(
"{string} with {int} CBDC available in the sidechain smart contract",
async function (user: string, amount: number) {
await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_ASSET_REF_NAME,
invocationType: "SEND",
@@ -49,7 +49,7 @@ When(
"{string} escrows {int} CBDC and creates an asset reference with id {string} in the sidechain",
async function (user: string, amount: number, assetRefID: string) {
await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_CBDC_ERC20_NAME,
invocationType: "SEND",
@@ -82,7 +82,7 @@ When(
"bob deletes the asset reference with id {string} in the sidechain",
async function (assetRefID: string) {
await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_ASSET_REF_NAME,
invocationType: "SEND",
@@ -125,7 +125,7 @@ Then(
"the asset reference with id {string} is locked in the sidechain",
async function (assetRefID: string) {
const response = await axios.post(
"http://localhost:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
"http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract",
{
contractName: BESU_CONTRACT_ASSET_REF_NAME,
invocationType: "CALL",
Original file line number Diff line number Diff line change
@@ -30,13 +30,13 @@ Then(
};

const response = await axios.post(
"http://localhost:4100/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
"http://127.0.0.1:4100/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
{
clientGatewayConfiguration: {
apiHost: `http://localhost:4100`,
apiHost: `http://127.0.0.1:4100`,
},
serverGatewayConfiguration: {
apiHost: `http://localhost:4000`,
apiHost: `http://127.0.0.1:4000`,
},
version: "0.0.0",
loggingProfile: "dummyLoggingProfile",
@@ -92,13 +92,13 @@ Then(

await axios
.post(
"http://localhost:4100/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
"http://127.0.0.1:4100/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
{
clientGatewayConfiguration: {
apiHost: `http://localhost:4100`,
apiHost: `http://127.0.0.1:4100`,
},
serverGatewayConfiguration: {
apiHost: `http://localhost:4000`,
apiHost: `http://127.0.0.1:4000`,
},
version: "0.0.0",
loggingProfile: "dummyLoggingProfile",
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ Then(
"the bridged out amount in the chaincode is {int} CBDC",
async function (amount: string) {
const response = await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -55,13 +55,13 @@ When(
};

const response = await axios.post(
"http://localhost:4000/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
"http://127.0.0.1:4000/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
{
clientGatewayConfiguration: {
apiHost: `http://localhost:4000`,
apiHost: `http://127.0.0.1:4000`,
},
serverGatewayConfiguration: {
apiHost: `http://localhost:4100`,
apiHost: `http://127.0.0.1:4100`,
},
version: "0.0.0",
loggingProfile: "dummyLoggingProfile",
@@ -118,13 +118,13 @@ Then(

await axios
.post(
"http://localhost:4000/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
"http://127.0.0.1:4000/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest",
{
clientGatewayConfiguration: {
apiHost: `http://localhost:4000`,
apiHost: `http://127.0.0.1:4000`,
},
serverGatewayConfiguration: {
apiHost: `http://localhost:4100`,
apiHost: `http://127.0.0.1:4100`,
},
version: "0.0.0",
loggingProfile: "dummyLoggingProfile",
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ Given(
"{string} with {int} CBDC available in the source chain",
async function (user: string, amount: number) {
await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_CBDC_ERC20_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -51,7 +51,7 @@ When(
"{string} escrows {int} CBDC and creates an asset reference with id {string} in the source chain",
async function (user: string, amount: number, assetRefID: string) {
await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_CBDC_ERC20_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -98,7 +98,7 @@ Then(
async function (user: string, assetRefID: string) {
return axios
.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_ASSET_REF_NAME,
channelName: FABRIC_CHANNEL_NAME,
@@ -126,7 +126,7 @@ Then(

axios
.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
"http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_CBDC_ERC20_NAME,
channelName: FABRIC_CHANNEL_NAME,
Original file line number Diff line number Diff line change
@@ -224,13 +224,13 @@ export class SupplyChainApp {
const httpGuiC = await Servers.startOnPort(3200, "0.0.0.0");

const addressInfoA = httpApiA.address() as AddressInfo;
const nodeApiHostA = `http://localhost:${addressInfoA.port}`;
const nodeApiHostA = `http://127.0.0.1:${addressInfoA.port}`;

const addressInfoB = httpApiB.address() as AddressInfo;
const nodeApiHostB = `http://localhost:${addressInfoB.port}`;
const nodeApiHostB = `http://127.0.0.1:${addressInfoB.port}`;

const addressInfoC = httpApiC.address() as AddressInfo;
const nodeApiHostC = `http://localhost:${addressInfoC.port}`;
const nodeApiHostC = `http://127.0.0.1:${addressInfoC.port}`;

const token = await this.getOrCreateToken();
const baseOptions = { headers: { Authorization: `Bearer ${token}` } };
@@ -464,7 +464,7 @@ export class SupplyChainApp {
const memberIdA = uuidv4();
const nodeIdA = uuidv4();
const addressInfoA = serverA.address() as AddressInfo;
const nodeApiHostA = `http://localhost:${addressInfoA.port}`;
const nodeApiHostA = `http://127.0.0.1:${addressInfoA.port}`;

const publickKeyPemA = await exportSPKI(keyPairA);
const cactusNodeA: CactusNode = {
@@ -492,7 +492,7 @@ export class SupplyChainApp {
const memberIdB = uuidv4();
const nodeIdB = uuidv4();
const addressInfoB = serverB.address() as AddressInfo;
const nodeApiHostB = `http://localhost:${addressInfoB.port}`;
const nodeApiHostB = `http://127.0.0.1:${addressInfoB.port}`;

const publickKeyPemB = await exportSPKI(keyPairB);
const cactusNodeB: CactusNode = {
@@ -521,7 +521,7 @@ export class SupplyChainApp {
const memberIdC = uuidv4();
const nodeIdC = uuidv4();
const addressInfoC = serverC.address() as AddressInfo;
const nodeApiHostC = `http://localhost:${addressInfoC.port}`;
const nodeApiHostC = `http://127.0.0.1:${addressInfoC.port}`;

const publickKeyPemC = await exportSPKI(keyPairC);
const cactusNodeC: CactusNode = {
Original file line number Diff line number Diff line change
@@ -143,7 +143,7 @@ test(testCase, async (t: Test) => {
expressApp.use(bodyParser.json({ limit: "250mb" }));
const server = http.createServer(expressApp);
const listenOptions: IListenOptions = {
hostname: "localhost",
hostname: "127.0.0.1",
port: 0,
server,
};
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ test(testCase, async (t: Test) => {
expressApp.use(bodyParser.json({ limit: "250mb" }));
const server = http.createServer(expressApp);
const listenOptions: IListenOptions = {
hostname: "localhost",
hostname: "127.0.0.1",
port: 0,
server: server,
};
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ test(testCase, async (t: Test) => {
expressApp.use(bodyParser.json({ limit: "250mb" }));
const server = http.createServer(expressApp);
const listenOptions: IListenOptions = {
hostname: "localhost",
hostname: "127.0.0.1",
port: 0,
server,
};
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ test(testCase, async (t: Test) => {
expressApp.use(bodyParser.json({ limit: "250mb" }));
const server = http.createServer(expressApp);
const listenOptions: IListenOptions = {
hostname: "localhost",
hostname: "127.0.0.1",
port: 0,
server,
};
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ test(testCase, async (t: Test) => {
expressApp.use(bodyParser.json({ limit: "250mb" }));
const server = http.createServer(expressApp);
const listenOptions: IListenOptions = {
hostname: "localhost",
hostname: "127.0.0.1",
port: 0,
server,
};
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ test("PluginObjectStoreIpfs", (t1: Test) => {
expressApp.use(bodyParser.json({ limit: "250mb" }));
const server = http.createServer(expressApp);
const listenOptions: IListenOptions = {
hostname: "localhost",
hostname: "127.0.0.1",
port: 0,
server,
};
Original file line number Diff line number Diff line change
@@ -511,7 +511,7 @@ export class ConfigService {
const cockpitPort = (schema.cockpitPort as SchemaObj).default;

const pkiGenerator = new SelfSignedPkiGenerator();
const pkiServer: IPki = pkiGenerator.create("localhost");
const pkiServer: IPki = pkiGenerator.create("127.0.0.1");

const plugins: PluginImport[] = [
{
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ test("NodeJS API server + Rust plugin work together", async (t: Test) => {
t.comment(`CactusKeychainVaultServer (Port=${hostPort}) started OK`);

const configuration = new Configuration({
basePath: `http://localhost:${hostPort}`,
basePath: `http://127.0.0.1:${hostPort}`,
});
const apiClient = new DefaultApi(configuration);

Loading

0 comments on commit 04cf2b3

Please sign in to comment.