forked from axonweb3/axon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
80 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,7 @@ jobs: | |
- name: Modify the Axon image of in devtools/chain/docker-compose.yml | ||
env: | ||
AXON_IMAGE: "${{ needs.build-amd64-image-to-ghcr.outputs.image_name }}:${{ needs.build-amd64-image-to-ghcr.outputs.image_tag }}" | ||
uses: mikefarah/[email protected].1 | ||
uses: mikefarah/[email protected].2 | ||
with: | ||
cmd: yq -i '.services.axon.image = "${{ env.AXON_IMAGE }}"' 'devtools/chain/docker-compose.yml' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,18 @@ | ||
import configSetting from "./config.json"; | ||
|
||
function makeRequest(method, url) { | ||
return new Promise((resolve, reject) => { | ||
const XMLHttpRequest = require("xhr2");// eslint-disable-line global-require | ||
const xhr = new XMLHttpRequest(); | ||
xhr.open(method, url); | ||
xhr.setRequestHeader("Content-type", "application/json"); | ||
xhr.send(JSON.stringify( | ||
{ | ||
id: 1, | ||
jsonrpc: "2.0", | ||
method: "eth_chainId", | ||
params: [ | ||
|
||
], | ||
}, | ||
)); | ||
xhr.onload = function load_() { | ||
if (this.status >= 200 && this.status < 300) { | ||
resolve(xhr.response); | ||
} else { | ||
reject(new Error("makeRequest fail")); | ||
} | ||
}; | ||
xhr.onerror = function error_() { | ||
// reject({ | ||
// status: this.status, | ||
// statusText: xhr.statusText, | ||
// }); | ||
reject(new Error("makeRequest fail")); | ||
}; | ||
// xhr.send(); | ||
}); | ||
} | ||
|
||
async function doAjaxThings() { | ||
const result = await makeRequest("POST", configSetting.axonRpc.url); | ||
|
||
return new Promise((resolve) => { | ||
resolve(parseInt(JSON.parse(result).result, 16)); | ||
}); | ||
} | ||
|
||
export default class Config { | ||
constructor() { | ||
this.axonRpc = { url: "", netWorkName: "", chainId: "" }; | ||
this.acount1 = ""; | ||
this.acount2 = ""; | ||
this.httpServer = ""; | ||
this.hexPrivateKey = ""; | ||
try { | ||
// eslint-disable-next-line no-console | ||
console.log(configSetting.axonRpc); | ||
this.axonRpc = configSetting.axonRpc; | ||
this.httpServer = configSetting.httpServer; | ||
this.hexPrivateKey = configSetting.hexPrivateKey; | ||
this.acount1 = configSetting.acount1; | ||
this.acount2 = configSetting.acount2; | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.log(err); | ||
throw err; | ||
} | ||
} | ||
|
||
async initialize() { | ||
this.axonRpc.chainId = await doAjaxThings(); | ||
this.axonRpc = configSetting.axonRpc; | ||
this.httpServer = configSetting.httpServer; | ||
this.hexPrivateKey = configSetting.hexPrivateKey; | ||
this.account1 = configSetting.account1; | ||
this.account2 = configSetting.account2; | ||
} | ||
|
||
static getIns() { | ||
if (!Config.ins) { | ||
Config.ins = new Config(); | ||
} | ||
(async function init_() { | ||
await Config.ins.initialize(); | ||
}()); | ||
return Config.ins; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.