-
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.
Merge pull request #12 from ideal-lab5/feat/9-murmurjs-move-communica…
…tion-with-idn-to-the-client Feat/9 murmurjs move communication with idn to the client
- Loading branch information
Showing
13 changed files
with
450 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/dist | ||
/node_modules | ||
dist | ||
node_modules | ||
package-lock.json |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "murmur-example-create-execute", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"typescript": "^4.9.5" | ||
}, | ||
"dependencies": { | ||
"@polkadot/api": "^13.2.1", | ||
"axios": "^1.7.7", | ||
"murmur.js": "file:../../../murmur.js" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ApiPromise, WsProvider } from "@polkadot/api"; | ||
import axios from "axios"; | ||
import { MurmurClient } from "murmur.js"; | ||
|
||
/* Polkadot API initialization */ | ||
const provider = new WsProvider("ws://127.0.0.1:9944"); | ||
console.log("Provider initialized"); | ||
const api = await ApiPromise.create({ provider }); | ||
console.log("API initialized"); | ||
// Retrieve the chain & node information via rpc calls | ||
const [chain, nodeName, nodeVersion] = await Promise.all([ | ||
api.rpc.system.chain(), | ||
api.rpc.system.name(), | ||
api.rpc.system.version(), | ||
]); | ||
console.log( | ||
`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}` | ||
); | ||
|
||
/* Axios initialization */ | ||
const httpClient = axios.create({ | ||
baseURL: "http://127.0.0.1:8000", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
|
||
/* MurmurClient initialization */ | ||
const murmurClient = new MurmurClient(httpClient, api); | ||
console.log("MurmurClient initialized"); | ||
|
||
const loguinResult = await murmurClient.authenticate("admin", "password"); | ||
console.log(loguinResult); | ||
|
||
await murmurClient.new(100, async (result: any) => { | ||
console.log(`Tx Block Hash: ${result.status.asFinalized}`); | ||
const bob = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"; | ||
const call = api.tx.balances.transferAllowDeath(bob, 1000000000000); | ||
await murmurClient.execute(call); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"include": ["src/**/*"] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "murmur-example-simple-connect", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"typescript": "^4.9.5" | ||
}, | ||
"dependencies": { | ||
"@polkadot/api": "^13.2.1", | ||
"axios": "^1.7.7", | ||
"murmur.js": "file:../../../murmur.js" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ApiPromise, WsProvider } from "@polkadot/api"; | ||
import axios from "axios"; | ||
import { MurmurClient } from "murmur.js"; | ||
|
||
/* Polkadot API initialization */ | ||
const provider = new WsProvider("ws://127.0.0.1:9944"); | ||
console.log("Provider initialized"); | ||
const api = await ApiPromise.create({ provider }); | ||
console.log("API initialized"); | ||
// Retrieve the chain & node information via rpc calls | ||
const [chain, nodeName, nodeVersion] = await Promise.all([ | ||
api.rpc.system.chain(), | ||
api.rpc.system.name(), | ||
api.rpc.system.version(), | ||
]); | ||
console.log( | ||
`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}` | ||
); | ||
|
||
/* Axios initialization */ | ||
const httpClient = axios.create({ | ||
baseURL: "https://api.example.com", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
|
||
/* MurmurClient initialization */ | ||
new MurmurClient(httpClient, api); | ||
console.log("MurmurClient initialized"); |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"include": ["src/**/*"] | ||
} |
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
}, | ||
"author": "Ideal Labs <[email protected]>", | ||
"dependencies": { | ||
"@polkadot/api": "^13.2.1", | ||
"axios": "^1.7.7" | ||
}, | ||
"devDependencies": { | ||
|
Oops, something went wrong.