Skip to content

Commit 3ca6bcb

Browse files
Merge pull request #10123 from BitGo/WCN-655-statics-supports-memo
feat(statics): add SUPPORTS_MEMO coin feature
2 parents ed3886a + 2408f5a commit 3ca6bcb

3 files changed

Lines changed: 109 additions & 0 deletions

File tree

‎modules/statics/src/base.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,12 @@ export enum CoinFeature {
441441
*/
442442
ALPHANUMERIC_MEMO_ID = 'alphanumeric-memo-id',
443443

444+
/**
445+
* This coin supports memos/tags embedded in addresses (e.g. `?memoId=`, `?dt=`, `?transferId=`)
446+
* to route deposits to a shared base address. Consumers use this to strip and compare memos.
447+
*/
448+
SUPPORTS_MEMO = 'supports-memo',
449+
444450
/**
445451
* This coin supports WalletConnect
446452
*/

‎modules/statics/src/coinFeatures.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export const XLM_FEATURES = [
155155
CoinFeature.CUSTODY_BITGO_SINGAPORE,
156156
CoinFeature.MULTISIG_COLD,
157157
CoinFeature.MULTISIG,
158+
CoinFeature.SUPPORTS_MEMO,
158159
];
159160
export const XTZ_FEATURES = [
160161
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -175,6 +176,7 @@ export const XRP_FEATURES = [
175176
CoinFeature.CUSTODY_BITGO_KOREA,
176177
CoinFeature.MULTISIG_COLD,
177178
CoinFeature.MULTISIG,
179+
CoinFeature.SUPPORTS_MEMO,
178180
];
179181
export const POLYGON_TOKEN_FEATURES_WITH_FRANKFURT = [
180182
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -191,6 +193,7 @@ export const CSPR_FEATURES = [
191193
CoinFeature.MULTISIG_COLD,
192194
CoinFeature.MULTISIG,
193195
CoinFeature.STAKING,
196+
CoinFeature.SUPPORTS_MEMO,
194197
];
195198
export const ALGO_FEATURES = [
196199
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -238,6 +241,7 @@ export const DOT_FEATURES = [
238241
CoinFeature.REBUILD_ON_CUSTODY_SIGNING,
239242
CoinFeature.CUSTODY_BITGO_FRANKFURT,
240243
CoinFeature.STUCK_TRANSACTION_MANAGEMENT_TSS,
244+
CoinFeature.SUPPORTS_MEMO,
241245
];
242246
export const EOS_FEATURES = [
243247
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -247,6 +251,7 @@ export const EOS_FEATURES = [
247251
CoinFeature.CUSTODY_BITGO_SINGAPORE,
248252
CoinFeature.MULTISIG_COLD,
249253
CoinFeature.MULTISIG,
254+
CoinFeature.SUPPORTS_MEMO,
250255
];
251256
export const HBAR_FEATURES = [
252257
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -259,6 +264,7 @@ export const HBAR_FEATURES = [
259264
CoinFeature.BULK_TRANSACTION,
260265
CoinFeature.ALPHANUMERIC_MEMO_ID,
261266
CoinFeature.STAKING,
267+
CoinFeature.SUPPORTS_MEMO,
262268
];
263269
export const POLYGON_FEATURES = [
264270
...ETH_FEATURES_WITH_MMI,
@@ -314,6 +320,7 @@ export const SOL_FEATURES = [
314320
CoinFeature.BULK_TRANSACTION,
315321
CoinFeature.WALLET_CONNECT_DEFI,
316322
CoinFeature.CUSTODY_BULK_TRANSACTION,
323+
CoinFeature.SUPPORTS_MEMO,
317324
];
318325
export const TSOL_FEATURES = [...SOL_FEATURES, CoinFeature.BULK_TRANSACTION, CoinFeature.CUSTODY_BITGO_SINGAPORE];
319326
export const SOL_TOKEN_FEATURES = [
@@ -376,6 +383,7 @@ export const STX_FEATURES = [
376383
CoinFeature.STAKING,
377384
CoinFeature.SUPPORTS_TOKENS,
378385
CoinFeature.ALPHANUMERIC_MEMO_ID,
386+
CoinFeature.SUPPORTS_MEMO,
379387
];
380388
export const STX_TOKEN_FEATURES = [
381389
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -493,6 +501,7 @@ export const COSMOS_SIDECHAIN_FEATURES = [
493501
CoinFeature.ALPHANUMERIC_MEMO_ID,
494502
CoinFeature.SUPPORTS_TOKENS,
495503
CoinFeature.CUSTODY_BULK_TRANSACTION,
504+
CoinFeature.SUPPORTS_MEMO,
496505
];
497506
export const COSMOS_SIDECHAIN_FEATURES_WITH_STAKING = [
498507
...COSMOS_SIDECHAIN_FEATURES,
@@ -539,6 +548,7 @@ export const TON_FEATURES = [
539548
CoinFeature.CUSTODY_BITGO_KOREA,
540549
CoinFeature.ALPHANUMERIC_MEMO_ID,
541550
CoinFeature.SUPPORTS_TOKENS,
551+
CoinFeature.SUPPORTS_MEMO,
542552
];
543553
export const TON_TOKEN_FEATURES = [
544554
...ACCOUNT_COIN_DEFAULT_FEATURES,
@@ -622,6 +632,7 @@ export const BERA_FEATURES = [
622632
CoinFeature.CUSTODY_BITGO_GERMANY,
623633
CoinFeature.CUSTODY_BULK_TRANSACTION,
624634
CoinFeature.ERC20_BULK_TRANSACTION,
635+
CoinFeature.SUPPORTS_MEMO,
625636
];
626637
export const OAS_FEATURES = [
627638
...ETH_FEATURES,
@@ -692,6 +703,7 @@ export const ICP_FEATURES = [
692703
CoinFeature.SHA256_WITH_ECDSA_TSS,
693704
CoinFeature.REBUILD_ON_CUSTODY_SIGNING,
694705
CoinFeature.TSS_VERIFY_USE_SERIALIZED_TX_HEX,
706+
CoinFeature.SUPPORTS_MEMO,
695707
];
696708

697709
export const STARKNET_FEATURES = [
@@ -737,6 +749,7 @@ export const POLYX_FEATURES = [
737749
CoinFeature.STAKING,
738750
CoinFeature.SUPPORTS_TOKENS,
739751
CoinFeature.STUCK_TRANSACTION_MANAGEMENT_TSS,
752+
CoinFeature.SUPPORTS_MEMO,
740753
];
741754

742755
export const POLYX_TOKEN_FEATURES = [
@@ -839,6 +852,7 @@ export const CANTON_FEATURES = [
839852
CoinFeature.REQUIRES_DEPOSIT_ACCEPTANCE_TRANSACTION,
840853
CoinFeature.ALPHANUMERIC_MEMO_ID,
841854
CoinFeature.SUPPORTS_TOKENS,
855+
CoinFeature.SUPPORTS_MEMO,
842856
];
843857

844858
export const CANTON_TOKEN_FEATURES = [

‎modules/statics/test/unit/coins.ts‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,95 @@ describe('TSS Verify Use Serialized Tx Hex Feature', () => {
14541454
});
14551455
});
14561456

1457+
describe('Supports Memo Feature', () => {
1458+
it('should have SUPPORTS_MEMO for the memo base coins', () => {
1459+
const memoCoins = [
1460+
'xlm',
1461+
'txlm',
1462+
'xrp',
1463+
'txrp',
1464+
'cspr',
1465+
'tcspr',
1466+
'ton',
1467+
'tton',
1468+
'icp',
1469+
'ticp',
1470+
'canton',
1471+
'tcanton',
1472+
'polyx',
1473+
'tpolyx',
1474+
'hbar',
1475+
'thbar',
1476+
'atom',
1477+
'tatom',
1478+
'osmo',
1479+
'tosmo',
1480+
'tia',
1481+
'ttia',
1482+
'sei',
1483+
'tsei',
1484+
'zeta',
1485+
'tzeta',
1486+
'coreum',
1487+
'tcoreum',
1488+
'injective',
1489+
'tinjective',
1490+
'bld',
1491+
'tbld',
1492+
'hash',
1493+
'thash',
1494+
'baby',
1495+
'tbaby',
1496+
'dot',
1497+
'tdot',
1498+
'sol',
1499+
'tsol',
1500+
'stx',
1501+
'tstx',
1502+
'eos',
1503+
'teos',
1504+
'bera',
1505+
'tbera',
1506+
'islm',
1507+
'tislm',
1508+
'thorchain:rune',
1509+
'tthorchain:rune',
1510+
'cronos',
1511+
'tcronos',
1512+
'asi',
1513+
'tasi',
1514+
'initia',
1515+
'tinitia',
1516+
'dydxcosmos',
1517+
'tdydxcosmos',
1518+
'kavacosmos',
1519+
'tkavacosmos',
1520+
'mantra',
1521+
'tmantra',
1522+
];
1523+
memoCoins.forEach((coinName) => {
1524+
const coin = coins.get(coinName);
1525+
coin.features.includes(CoinFeature.SUPPORTS_MEMO).should.eql(true);
1526+
});
1527+
});
1528+
1529+
it('should have SUPPORTS_MEMO on every non-token cosmos-like coin', () => {
1530+
coins.forEach((coin) => {
1531+
if (!coin.isToken && coin.features.includes(CoinFeature.COSMOS_LIKE_COINS)) {
1532+
coin.features.includes(CoinFeature.SUPPORTS_MEMO).should.eql(true);
1533+
}
1534+
});
1535+
});
1536+
1537+
it('should not have SUPPORTS_MEMO on non-memo coins', () => {
1538+
const nonMemoCoins = ['btc', 'tbtc', 'eth', 'hteth', 'algo', 'tempo'];
1539+
nonMemoCoins.forEach((coinName) => {
1540+
const coin = coins.get(coinName);
1541+
coin.features.includes(CoinFeature.SUPPORTS_MEMO).should.eql(false);
1542+
});
1543+
});
1544+
});
1545+
14571546
describe('Custody Bulk Withdrawal Features', () => {
14581547
it('should have CUSTODY_BULK_TRANSACTION feature for appropriate coins', () => {
14591548
const custodyBulkWithdrawalCoins = [

0 commit comments

Comments
 (0)