Clean up AMM TS code sample

This commit is contained in:
mDuo13
2024-01-02 16:52:59 -08:00
parent 2981e86c59
commit 5efe4272de
3 changed files with 14 additions and 15 deletions

View File

@@ -25,25 +25,27 @@ import {
} from './util/consts';
/**
* Script for demonstrating AMM functionality, both token/token and token/XRP
* AMM機能を試すためのスクリプト
*/
async function main() {
const client = new xrpl.Client(WS_URL);
await client.connect()
// Get credentials from the Faucet -------------------------------------------
// Get credentials from the Faucet ------------------------------------------
console.log("Requesting address from the faucet...")
// const wallet = (await client.fundWallet()).wallet
const wallet = (await client.fundWallet()).wallet
// To use an existing account, use code such as the following:
const wallet = xrpl.Wallet.fromSeed(process.env.SECRET_FEED!)
// const wallet = xrpl.Wallet.fromSeed(process.env.SECRET_FEED!)
// Create New Token
// Token<->Token AMM (FOO/MSH) example ======================================
// Issue tokens
// トークンを発行
const msh_amount = await get_new_token(client, wallet, "MSH", "10000")
// call get new token method (FOO トークンを発行)
const foo_amount = await get_new_token(client, wallet, "FOO", "1000")
// Acquire tokens ------------------------------------------------------------
// Acquire tokens -----------------------------------------------------------
await acquireTokens(client, wallet, msh_amount);
await acquireTokens(client, wallet, foo_amount);
@@ -95,10 +97,8 @@ async function main() {
const {
account_lines_result: account_lines_result2,
} = await confirmAmm(client, wallet, amm_info_request);
//console.log("account_lines_result2:", account_lines_result2)
// ============= (another XRP pattern) ===============
// Token<->XRP AMM (FOO/XRP) example ========================================
// create AMM Info (another XRP pattern)
const amm_info_request2: AmmInfo = {
@@ -148,4 +148,4 @@ async function main() {
await client.disconnect()
}
main()
main()

View File

@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"create-amm": "ts-node src/create-amm.ts"
"create-amm": "ts-node create-amm.ts"
},
"keywords": [],
"author": "",

View File

@@ -5,14 +5,13 @@
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
"esModuleInterop": true,
// "preserveSymlinks": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
/* Type Checking */
"strict": true,
"skipLibCheck": true
},
"include": [
"src/**/*"
"./**/*"
],
}