Skip to content

Commit 9211ff6

Browse files
authored
fix: add MPTCurrency type (#2964)
* add MPTCurrency * update HISTORY * refactor types in createAMMPool * update ammInfo test
1 parent b4be409 commit 9211ff6

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

packages/xrpl/HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
1111
* `OracleSet` transaction accepts hexadecimal string values for `AssetPrice` field
1212
* `TransactionStream` model includes `hash` field in APIv2
1313
* `TransactionStream` model includes `close_time_iso` field only for APIv2
14+
* Adds `MPTCurrency` type
1415

1516
## 4.2.0 (2025-2-13)
1617

packages/xrpl/src/models/common/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export interface IssuedCurrency {
1414
issuer: string
1515
}
1616

17-
export type Currency = IssuedCurrency | XRP
17+
export interface MPTCurrency {
18+
mpt_issuance_id: string
19+
}
20+
21+
export type Currency = IssuedCurrency | MPTCurrency | XRP
1822

1923
export interface IssuedCurrencyAmount extends IssuedCurrency {
2024
value: string

packages/xrpl/test/integration/requests/ammInfo.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ describe('AMMInfo', function () {
3737
assert.equal(amm.amount, '1250')
3838
assert.deepEqual(amm.amount2, {
3939
currency: asset2.currency,
40-
// @ts-expect-error: asset2.issuer should be defined at this point
4140
issuer: asset2.issuer,
4241
value: '250',
4342
})

packages/xrpl/test/integration/setup.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import {
44
AMMDeposit,
55
AMMDepositFlags,
66
Client,
7-
Currency,
7+
IssuedCurrency,
88
SignerListSet,
99
Wallet,
1010
XChainBridge,
1111
XChainCreateBridge,
12+
XRP,
1213
} from '../../src'
1314

1415
import serverUrl from './serverUrl'
@@ -24,8 +25,8 @@ export interface TestAMMPool {
2425
issuerWallet: Wallet
2526
lpWallet: Wallet
2627
testWallet: Wallet
27-
asset: Currency
28-
asset2: Currency
28+
asset: XRP
29+
asset2: IssuedCurrency
2930
}
3031

3132
interface TestBridge {

packages/xrpl/test/integration/transactions/ammCreate.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe('AMMCreate', function () {
3636
assert.equal(amm.amount, '250')
3737
assert.deepEqual(amm.amount2, {
3838
currency: asset2.currency,
39-
// @ts-expect-error: asset2.issuer should be defined at this point
4039
issuer: asset2.issuer,
4140
value: '250',
4241
})

packages/xrpl/test/integration/transactions/ammDeposit.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ describe('AMMDeposit', function () {
102102
Amount: '100',
103103
Amount2: {
104104
currency: asset2.currency,
105-
// @ts-expect-error: asset2.issuer should be defined at this point
106105
issuer: asset2.issuer,
107106
value: '100',
108107
},

packages/xrpl/test/integration/transactions/ammWithdraw.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ describe('AMMWithdraw', function () {
110110
Amount: '50',
111111
Amount2: {
112112
currency: asset2.currency,
113-
// @ts-expect-error: asset2.issuer should be defined at this point
114113
issuer: asset2.issuer,
115114
value: '50',
116115
},

packages/xrpl/test/integration/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
ECDSA,
1515
AccountLinesRequest,
1616
IssuedCurrency,
17-
Currency,
17+
XRP,
1818
} from '../../src'
1919
import {
2020
AMMCreate,
@@ -380,8 +380,8 @@ export async function createAMMPool(
380380
): Promise<{
381381
issuerWallet: Wallet
382382
lpWallet: Wallet
383-
asset: Currency
384-
asset2: Currency
383+
asset: XRP
384+
asset2: IssuedCurrency
385385
}> {
386386
const lpWallet = await generateFundedWallet(client)
387387
const issuerWallet = await generateFundedWallet(client)
@@ -445,8 +445,8 @@ export async function createAMMPool(
445445

446446
await testTransaction(client, ammCreateTx, lpWallet)
447447

448-
const asset: Currency = { currency: 'XRP' }
449-
const asset2: Currency = {
448+
const asset: XRP = { currency: 'XRP' }
449+
const asset2: IssuedCurrency = {
450450
currency: currencyCode,
451451
issuer: issuerWallet.classicAddress,
452452
}

0 commit comments

Comments
 (0)