mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Compare commits
5 Commits
xrpl@2.4.0
...
denis-icv2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01fb1c28d4 | ||
|
|
ac85c5de6f | ||
|
|
8a9a9bcc28 | ||
|
|
76b73e16a9 | ||
|
|
1673f4b964 |
@@ -53,7 +53,14 @@ npm test
|
|||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
|
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
|
||||||
docker run -p 6006:6006 -it natenichols/rippled-standalone:latest
|
docker run -p 6006:6006 -it gcr.io/metaxrplorer/icv2:latest
|
||||||
|
|
||||||
|
# If you want to run rippled w/ explorer run the following
|
||||||
|
# Run rippled in standalone
|
||||||
|
docker run -p 6006:6006 -p 80:80 -it gcr.io/metaxrplorer/icv2:latest
|
||||||
|
# In another shell run the explorer
|
||||||
|
docker run -e VUE_APP_WSS_ENDPOINT=ws://0.0.0.0:80 -p 3000:3000 -it gcr.io/metaxrplorer/explorer:latest
|
||||||
|
|
||||||
npm run build
|
npm run build
|
||||||
npm run test:integration
|
npm run test:integration
|
||||||
```
|
```
|
||||||
@@ -69,7 +76,7 @@ The other is in the command line (this is what we use for CI) -
|
|||||||
```bash
|
```bash
|
||||||
npm run build
|
npm run build
|
||||||
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
|
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
|
||||||
docker run -p 6006:6006 -it natenichols/rippled-standalone:latest
|
docker run -p 6006:6006 -it gcr.io/metaxrplorer/icv2:latest
|
||||||
npm run test:browser
|
npm run test:browser
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
1938
package-lock.json
generated
1938
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -73,7 +73,7 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0",
|
"node": ">=12.0.0",
|
||||||
"npm": ">=7.0.0 < 8.0.0"
|
"npm": ">=7.0.0 < 8.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
# xrpl.js (ripple-lib) Release History
|
# xrpl.js (ripple-lib) Release History
|
||||||
|
|
||||||
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.
|
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Added
|
### Added
|
||||||
|
* Support for ExpandedSignerList amendment that expands the maximum signer list to 32 entries.
|
||||||
|
|
||||||
- Export `verify` from ripple-keypairs as `verifyKeypairSignature` for use in web-apps.
|
## 2.4.0 (2022-09-01)
|
||||||
|
### Added
|
||||||
|
* Export `verify` from ripple-keypairs as `verifyKeypairSignature` for use in web-apps.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* `Wallet.fromMnemonic` now allows lowercase for RFC1751 mnemonics (#2046)
|
* `Wallet.fromMnemonic` now allows lowercase for RFC1751 mnemonics (#2046)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
"docgen": "typedoc && echo js.xrpl.org >> ../../docs/CNAME",
|
"docgen": "typedoc && echo js.xrpl.org >> ../../docs/CNAME",
|
||||||
"prepublish": "run-s clean build",
|
"prepublish": "run-s clean build",
|
||||||
"test": "nyc mocha --config=test/.mocharc.json --exit",
|
"test": "nyc mocha --config=test/.mocharc.json --exit",
|
||||||
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/integration/**/*.ts ./test/integration/*.ts",
|
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/integration/transactions/paymentChannelCreate.ts",
|
||||||
"test:browser": "npm run build:browserTests && TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/browser/*.ts",
|
"test:browser": "npm run build:browserTests && TS_NODE_PROJECT=tsconfig.build.json nyc mocha ./test/browser/*.ts",
|
||||||
"test:watch": "TS_NODE_PROJECT=src/tsconfig.json mocha --config=test/.mocharc.json --watch --reporter dot",
|
"test:watch": "TS_NODE_PROJECT=src/tsconfig.json mocha --config=test/.mocharc.json --watch --reporter dot",
|
||||||
"format": "prettier --write '{src,test}/**/*.ts'",
|
"format": "prettier --write '{src,test}/**/*.ts'",
|
||||||
|
|||||||
@@ -61,10 +61,31 @@ interface PathStep {
|
|||||||
|
|
||||||
export type Path = PathStep[]
|
export type Path = PathStep[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The object that describes the signer in SignerEntries.
|
||||||
|
*/
|
||||||
export interface SignerEntry {
|
export interface SignerEntry {
|
||||||
|
/**
|
||||||
|
* The object that describes the signer in SignerEntries.
|
||||||
|
*/
|
||||||
SignerEntry: {
|
SignerEntry: {
|
||||||
|
/**
|
||||||
|
* An XRP Ledger address whose signature contributes to the multi-signature.
|
||||||
|
* It does not need to be a funded address in the ledger.
|
||||||
|
*/
|
||||||
Account: string
|
Account: string
|
||||||
|
/**
|
||||||
|
* The weight of a signature from this signer.
|
||||||
|
* A multi-signature is only valid if the sum weight of the signatures provided meets
|
||||||
|
* or exceeds the signer list's SignerQuorum value.
|
||||||
|
*/
|
||||||
SignerWeight: number
|
SignerWeight: number
|
||||||
|
/**
|
||||||
|
* An arbitrary 256-bit (32-byte) field that can be used to identify the signer, which
|
||||||
|
* may be useful for smart contracts, or for identifying who controls a key in a large
|
||||||
|
* organization.
|
||||||
|
*/
|
||||||
|
WalletLocator?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
||||||
import { ValidationError } from '../../errors'
|
import { ValidationError } from '../../errors'
|
||||||
|
import { Amount } from '../common'
|
||||||
|
|
||||||
import { BaseTransaction, validateBaseTransaction } from './common'
|
import { BaseTransaction, validateBaseTransaction } from './common'
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ export interface PaymentChannelCreate extends BaseTransaction {
|
|||||||
* Destination address. When the channel closes, any unclaimed XRP is returned
|
* Destination address. When the channel closes, any unclaimed XRP is returned
|
||||||
* to the source address's balance.
|
* to the source address's balance.
|
||||||
*/
|
*/
|
||||||
Amount: string
|
Amount: Amount
|
||||||
/**
|
/**
|
||||||
* Address to receive XRP claims against this channel. This is also known as
|
* Address to receive XRP claims against this channel. This is also known as
|
||||||
* the "destination address" for the channel.
|
* the "destination address" for the channel.
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ export interface SignerListSet extends BaseTransaction {
|
|||||||
/**
|
/**
|
||||||
* Array of SignerEntry objects, indicating the addresses and weights of
|
* Array of SignerEntry objects, indicating the addresses and weights of
|
||||||
* signers in this list. This signer list must have at least 1 member and no
|
* signers in this list. This signer list must have at least 1 member and no
|
||||||
* more than 8 members. No address may appear more than once in the list, nor
|
* more than 32 members. No address may appear more than once in the list, nor
|
||||||
* may the Account submitting the transaction appear in the list.
|
* may the Account submitting the transaction appear in the list.
|
||||||
*/
|
*/
|
||||||
SignerEntries: SignerEntry[]
|
SignerEntries: SignerEntry[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_SIGNERS = 8
|
const MAX_SIGNERS = 32
|
||||||
|
|
||||||
|
const HEX_WALLET_LOCATOR_REGEX = /^[0-9A-Fa-f]{64}$/u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify the form and type of an SignerListSet at runtime.
|
* Verify the form and type of an SignerListSet at runtime.
|
||||||
@@ -61,7 +63,21 @@ export function validateSignerListSet(tx: Record<string, unknown>): void {
|
|||||||
|
|
||||||
if (tx.SignerEntries.length > MAX_SIGNERS) {
|
if (tx.SignerEntries.length > MAX_SIGNERS) {
|
||||||
throw new ValidationError(
|
throw new ValidationError(
|
||||||
'SignerListSet: maximum of 8 members allowed in SignerEntries',
|
`SignerListSet: maximum of ${MAX_SIGNERS} members allowed in SignerEntries`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const entry of tx.SignerEntries) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Should be a SignerEntry
|
||||||
|
const signerEntry = entry as SignerEntry
|
||||||
|
const { WalletLocator } = signerEntry.SignerEntry
|
||||||
|
if (
|
||||||
|
WalletLocator !== undefined &&
|
||||||
|
!HEX_WALLET_LOCATOR_REGEX.test(WalletLocator)
|
||||||
|
) {
|
||||||
|
throw new ValidationError(
|
||||||
|
`SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,4 +27,25 @@ describe('PaymentChannelCreate', function () {
|
|||||||
|
|
||||||
await testTransaction(this.client, paymentChannelCreate, this.wallet)
|
await testTransaction(this.client, paymentChannelCreate, this.wallet)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('base ic', async function () {
|
||||||
|
const wallet2 = await generateFundedWallet(this.client)
|
||||||
|
const wallet3 = await generateFundedWallet(this.client)
|
||||||
|
console.log(wallet2);
|
||||||
|
|
||||||
|
const paymentChannelCreate: PaymentChannelCreate = {
|
||||||
|
TransactionType: 'PaymentChannelCreate',
|
||||||
|
Account: this.wallet.classicAddress,
|
||||||
|
Amount: {
|
||||||
|
currency: 'USD',
|
||||||
|
issuer: wallet3.classicAddress,
|
||||||
|
value: '10',
|
||||||
|
},
|
||||||
|
Destination: wallet2.classicAddress,
|
||||||
|
SettleDelay: 86400,
|
||||||
|
PublicKey: this.wallet.publicKey,
|
||||||
|
}
|
||||||
|
|
||||||
|
await testTransaction(this.client, paymentChannelCreate, this.wallet)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -89,4 +89,127 @@ describe('SignerListSet', function () {
|
|||||||
'SignerListSet: invalid SignerEntries',
|
'SignerListSet: invalid SignerEntries',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it(`throws w/ maximum of 32 members allowed in SignerEntries`, function () {
|
||||||
|
signerListSetTx.SignerEntries = []
|
||||||
|
const accounts = [
|
||||||
|
'rBFBipte4nAQCTsRxd2czwvSurhCpAf4X6',
|
||||||
|
'r3ijUH32iiy9tYNj3rD7hKWYjy1BFUxngm',
|
||||||
|
'rpwq8vi4Mn3L5kDJmb8Mg59CanPFPzMCnj',
|
||||||
|
'rB72Gzqfejai46nkA4HaKYBHwAnn2yUoT4',
|
||||||
|
'rGqsJSAW71pCfUwDD5m52bLw69RzFg6kMW',
|
||||||
|
'rs8smPRA31Ym4mGxb1wzgwxtU5eVK82Gyk',
|
||||||
|
'rLrugpGxzezUQLDh7Jv1tZpouuV4MQLbU9',
|
||||||
|
'rUQ6zLXQdh1jJLGwMXp9P8rgi42kwuafzs',
|
||||||
|
'rMjY8sPdfxsyRrnVKQcutxr4mTHNXy9dEF',
|
||||||
|
'rUaxYLeFGm6SmMoa2WCqLKSyHwJyvaQmeG',
|
||||||
|
'r9wUfeVtqMfqrcDTfCpNYbNZvs5q9M9Rpo',
|
||||||
|
'rQncVNak5kvJGPUFa6fuKH7t8Usjs7Np1c',
|
||||||
|
'rnwbSSnPbVbUzuBa4etkeYrfy5v7SyhtPu',
|
||||||
|
'rDXh5D3t48MdBJyXByXq47k5P8Kuf1758B',
|
||||||
|
'rh1D4jd2mAiqUPHfAZ2cY9Nbfa3kAkaQXP',
|
||||||
|
'r9T129tXgtnyfGoLeS35c2HctaZAZSQoCH',
|
||||||
|
'rUd2uKsyCWfJP7Ve36mKoJbNCA7RYThnYk',
|
||||||
|
'r326x8PaAFtnaH7uoxaKrcDWuwpeHn4wDa',
|
||||||
|
'rpN3mkXkYhfNadcXPrY4LniM1KpM3egyQM',
|
||||||
|
'rsPKbR155hz1zrA4pSJp5Y2fxasZAatcHb',
|
||||||
|
'rsyWFLaEKTpaoSJusjpcDvGexuHCwMnqss',
|
||||||
|
'rUbc5RXfyF81oLDMgd3d7jpY9YMNMZG4XN',
|
||||||
|
'rGpYHM88BZe1iVKFHm5xiWYYxR74oxJEXf',
|
||||||
|
'rPsetWAtR1KxDtxzgHjRMD7Rc87rvXk5nD',
|
||||||
|
'rwSeNhL6Hi34igr12mCr61jY42psfTkWTq',
|
||||||
|
'r46Mygy98qjkDhVB6qs4sBnqaf7FPiA2vU',
|
||||||
|
'r4s8GmeYN4CiwVate1nMUvwMQbundqf5cW',
|
||||||
|
'rKAr4dQWDYG8cG2hSwJUVp4ry4WNaWiNgp',
|
||||||
|
'rPWXRLp1vqeUHEH3WiSKuyo9GM9XhaENQU',
|
||||||
|
'rPgmdBdRKGmndxNEYxUrrsYCZaS6go9RvW',
|
||||||
|
'rPDJZ9irzgwKRKScfEmuJMvUgrqZAJNCbL',
|
||||||
|
'rDuU2uSXMfEaoxN1qW8sj7aUNFLGEn3Hr2',
|
||||||
|
'rsbjSjA4TCB9gtm7x7SrWbZHB6g4tt9CGU',
|
||||||
|
]
|
||||||
|
signerListSetTx.SignerQuorum = accounts.length
|
||||||
|
for (const acc of accounts) {
|
||||||
|
signerListSetTx.SignerEntries.push({
|
||||||
|
SignerEntry: {
|
||||||
|
Account: acc,
|
||||||
|
SignerWeight: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const errorMessage =
|
||||||
|
'SignerListSet: maximum of 32 members allowed in SignerEntries'
|
||||||
|
assert.throws(
|
||||||
|
() => validateSignerListSet(signerListSetTx),
|
||||||
|
ValidationError,
|
||||||
|
errorMessage,
|
||||||
|
)
|
||||||
|
assert.throws(
|
||||||
|
() => validate(signerListSetTx),
|
||||||
|
ValidationError,
|
||||||
|
errorMessage,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`verifies valid WalletLocator in SignerEntries`, function () {
|
||||||
|
signerListSetTx.SignerQuorum = 3
|
||||||
|
signerListSetTx.SignerEntries = [
|
||||||
|
{
|
||||||
|
SignerEntry: {
|
||||||
|
Account: 'rBFBipte4nAQCTsRxd2czwvSurhCpAf4X6',
|
||||||
|
SignerWeight: 1,
|
||||||
|
WalletLocator:
|
||||||
|
'CAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SignerEntry: {
|
||||||
|
Account: 'r3ijUH32iiy9tYNj3rD7hKWYjy1BFUxngm',
|
||||||
|
SignerWeight: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SignerEntry: {
|
||||||
|
Account: 'rpwq8vi4Mn3L5kDJmb8Mg59CanPFPzMCnj',
|
||||||
|
SignerWeight: 1,
|
||||||
|
WalletLocator:
|
||||||
|
'00000000000000000000000000000000000000000000000000000000DEADBEEF',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
assert.doesNotThrow(() => validateSignerListSet(signerListSetTx))
|
||||||
|
assert.doesNotThrow(() => validate(signerListSetTx))
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`throws w/ invalid WalletLocator in SignerEntries`, function () {
|
||||||
|
signerListSetTx.SignerQuorum = 2
|
||||||
|
signerListSetTx.SignerEntries = [
|
||||||
|
{
|
||||||
|
SignerEntry: {
|
||||||
|
Account: 'rBFBipte4nAQCTsRxd2czwvSurhCpAf4X6',
|
||||||
|
SignerWeight: 1,
|
||||||
|
WalletLocator: 'not_valid',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SignerEntry: {
|
||||||
|
Account: 'r3ijUH32iiy9tYNj3rD7hKWYjy1BFUxngm',
|
||||||
|
SignerWeight: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const errorMessage =
|
||||||
|
'SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value'
|
||||||
|
assert.throws(
|
||||||
|
() => validateSignerListSet(signerListSetTx),
|
||||||
|
ValidationError,
|
||||||
|
errorMessage,
|
||||||
|
)
|
||||||
|
assert.throws(
|
||||||
|
() => validate(signerListSetTx),
|
||||||
|
ValidationError,
|
||||||
|
errorMessage,
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user