mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-28 08:05:51 +00:00
feat: add support for XLS-40d + add script to auto-generate models from rippled code (#2491)
Add support for XLS-40 and adds a script to automatically generate transaction models from rippled source code. ### Context of Change https://github.com/XRPLF/XRPL-Standards/pull/136 https://github.com/XRPLF/rippled/pull/4636
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { DIDSet, DIDDelete } from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('DIDDelete', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const setupTx: DIDSet = {
|
||||
TransactionType: 'DIDSet',
|
||||
Account: testContext.wallet.address,
|
||||
Data: '617474657374',
|
||||
DIDDocument: '646F63',
|
||||
URI: '6469645F6578616D706C65',
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, setupTx, testContext.wallet)
|
||||
|
||||
// double check the DID was properly created
|
||||
const initialAccountOffersResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.address,
|
||||
type: 'did',
|
||||
})
|
||||
assert.lengthOf(
|
||||
initialAccountOffersResponse.result.account_objects,
|
||||
1,
|
||||
'Should be exactly one DID on the ledger after a DIDSet transaction',
|
||||
)
|
||||
|
||||
// actual test - cancel the check
|
||||
const tx: DIDDelete = {
|
||||
TransactionType: 'DIDDelete',
|
||||
Account: testContext.wallet.address,
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// confirm that the DID no longer exists
|
||||
const accountOffersResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.address,
|
||||
type: 'did',
|
||||
})
|
||||
assert.lengthOf(
|
||||
accountOffersResponse.result.account_objects,
|
||||
0,
|
||||
'Should be no DID on the ledger after a DIDDelete transaction',
|
||||
)
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
50
packages/xrpl/test/integration/transactions/didSet.test.ts
Normal file
50
packages/xrpl/test/integration/transactions/didSet.test.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { DIDSet } from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
import { testTransaction } from '../utils'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('DIDSet', function () {
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const tx: DIDSet = {
|
||||
TransactionType: 'DIDSet',
|
||||
Account: testContext.wallet.classicAddress,
|
||||
Data: '617474657374',
|
||||
DIDDocument: '646F63',
|
||||
URI: '6469645F6578616D706C65',
|
||||
}
|
||||
|
||||
await testTransaction(testContext.client, tx, testContext.wallet)
|
||||
|
||||
// confirm that the DID was actually created
|
||||
const accountOffersResponse = await testContext.client.request({
|
||||
command: 'account_objects',
|
||||
account: testContext.wallet.classicAddress,
|
||||
type: 'did',
|
||||
})
|
||||
assert.lengthOf(
|
||||
accountOffersResponse.result.account_objects,
|
||||
1,
|
||||
'Should be exactly one DID on the ledger after a DIDSet transaction',
|
||||
)
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user