Skip to content

[DO NOT MERGE] Smart Escrows #2928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ripple-binary-codec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ripple-binary-codec",
"version": "2.3.0",
"version": "2.4.0-smartescrow.2",
"description": "XRP Ledger binary codec",
"files": [
"dist/*",
Expand Down
96 changes: 64 additions & 32 deletions packages/ripple-binary-codec/src/enums/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,56 @@
"type": "UInt32"
}
],
[
"ExtensionComputeLimit",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 53,
"type": "UInt32"
}
],
[
"ExtensionSizeLimit",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 54,
"type": "UInt32"
}
],
[
"GasPrice",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 55,
"type": "UInt32"
}
],
[
"ComputationAllowance",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 56,
"type": "UInt32"
}
],
[
"GasUsed",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 57,
"type": "UInt32"
}
],
[
"IndexNext",
{
Expand Down Expand Up @@ -940,16 +990,6 @@
"type": "UInt64"
}
],
[
"LockedAmount",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 29,
"type": "UInt64"
}
],
[
"EmailHash",
{
Expand Down Expand Up @@ -1890,6 +1930,16 @@
"type": "Blob"
}
],
[
"FinishFunction",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": true,
"nth": 32,
"type": "Blob"
}
],
[
"Account",
{
Expand Down Expand Up @@ -2460,16 +2510,6 @@
"type": "STObject"
}
],
[
"Book",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 36,
"type": "STObject"
}
],
[
"Signers",
{
Expand Down Expand Up @@ -2570,16 +2610,6 @@
"type": "STArray"
}
],
[
"AdditionalBooks",
{
"isSerialized": true,
"isSigningField": true,
"isVLEncoded": false,
"nth": 13,
"type": "STArray"
}
],
[
"Majorities",
{
Expand Down Expand Up @@ -3133,7 +3163,6 @@
"tecNFTOKEN_OFFER_TYPE_MISMATCH": 157,
"tecNO_ALTERNATIVE_KEY": 130,
"tecNO_AUTH": 134,
"tecNO_DELEGATE_PERMISSION": 198,
"tecNO_DST": 124,
"tecNO_DST_INSUF_XRP": 125,
"tecNO_ENTRY": 140,
Expand All @@ -3150,7 +3179,6 @@
"tecOWNERS": 132,
"tecPATH_DRY": 128,
"tecPATH_PARTIAL": 101,
"tecPRECISION_LOSS": 197,
"tecPSEUDO_ACCOUNT": 196,
"tecTOKEN_PAIR_NOT_FOUND": 189,
"tecTOO_SOON": 152,
Expand All @@ -3159,6 +3187,7 @@
"tecUNFUNDED_AMM": 162,
"tecUNFUNDED_OFFER": 103,
"tecUNFUNDED_PAYMENT": 104,
"tecWASM_REJECTED": 197,
"tecWRONG_ASSET": 194,
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
Expand Down Expand Up @@ -3197,8 +3226,10 @@
"tefNOT_MULTI_SIGNING": -184,
"tefNO_AUTH_REQUIRED": -191,
"tefNO_TICKET": -180,
"tefNO_WASM": -177,
"tefPAST_SEQ": -190,
"tefTOO_BIG": -181,
"tefWASM_FIELD_NOT_INCLUDED": -176,
"tefWRONG_PRIOR": -189,

"telBAD_DOMAIN": -398,
Expand Down Expand Up @@ -3246,6 +3277,7 @@
"temBAD_TICK_SIZE": -269,
"temBAD_TRANSFER_FEE": -251,
"temBAD_TRANSFER_RATE": -280,
"temBAD_WASM": -249,
"temBAD_WEIGHT": -270,
"temCANNOT_PREAUTH_SELF": -267,
"temDISABLED": -273,
Expand Down
4 changes: 2 additions & 2 deletions packages/xrpl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xrpl",
"version": "4.2.5",
"version": "4.3.0-smartescrow.3",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
Expand Down Expand Up @@ -29,7 +29,7 @@
"bignumber.js": "^9.0.0",
"eventemitter3": "^5.0.1",
"ripple-address-codec": "^5.0.0",
"ripple-binary-codec": "^2.3.0",
"ripple-binary-codec": "^2.4.0-smartescrow.2",
"ripple-keypairs": "^2.0.0"
},
"devDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions packages/xrpl/src/Wallet/defaultFaucets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ export interface FaucetWallet {
export enum FaucetNetwork {
Testnet = 'faucet.altnet.rippletest.net',
Devnet = 'faucet.devnet.rippletest.net',
WasmDevnet = 'wasmfaucet.devnet.rippletest.net',
}

export const faucetNetworkPaths: Record<string, string> = {
[FaucetNetwork.Testnet]: '/accounts',
[FaucetNetwork.Devnet]: '/accounts',
[FaucetNetwork.WasmDevnet]: '/accounts',
}

/* eslint-disable @typescript-eslint/no-magic-numbers -- this is where they're being defined */
export const faucetNetworkIDs: Map<number, FaucetNetwork> = new Map([
[1, FaucetNetwork.Testnet],
[2, FaucetNetwork.Devnet],
[2002, FaucetNetwork.WasmDevnet],
])
/* eslint-enable @typescript-eslint/no-magic-numbers */

/**
* Get the faucet host based on the Client connection.
Expand Down
4 changes: 4 additions & 0 deletions packages/xrpl/src/models/ledger/Escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ export default interface Escrow extends BaseLedgerEntry, HasPreviousTxnID {
* this object, in case the directory consists of multiple pages.
*/
DestinationNode?: string

FinishFunction?: string

Data?: string
}
4 changes: 4 additions & 0 deletions packages/xrpl/src/models/ledger/FeeSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export interface FeeSettingsPostAmendmentFields {
ReserveBaseDrops: string
/** The incremental owner reserve for owning objects, as drops of XRP. */
ReserveIncrementDrops: string

ExtensionComputeLimit: number

ExtensionSizeLimit: number
}

export interface FeeSettingsBase
Expand Down
9 changes: 9 additions & 0 deletions packages/xrpl/src/models/methods/serverInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export interface ServerInfoResponse extends BaseResponse {
hash: string
reserve_base_xrp: number
reserve_inc_xrp: number

extension_compute: number
extension_size: number
gas_price: number

seq: number
}
/**
Expand Down Expand Up @@ -252,6 +257,10 @@ export interface ServerInfoResponse extends BaseResponse {
* object an account owns in the ledger.
*/
reserve_inc_xrp: number

extension_compute: number
extension_size: number
gas_price: number
/** The ledger index of the latest validated ledger. */
seq: number
}
Expand Down
10 changes: 10 additions & 0 deletions packages/xrpl/src/models/methods/serverState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export interface ServerStateResponse extends BaseResponse {
hash: string
reserve_base: number
reserve_inc: number

extension_compute: number
extension_size: number
gas_price: number

seq: number
}
io_latency_ms: number
Expand Down Expand Up @@ -69,6 +74,11 @@ export interface ServerStateResponse extends BaseResponse {
hash: string
reserve_base: number
reserve_inc: number

extension_compute: number
extension_size: number
gas_price: number

seq: number
}
validation_quorum: number
Expand Down
12 changes: 10 additions & 2 deletions packages/xrpl/src/models/transactions/escrowCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export interface EscrowCreate extends BaseTransaction {
* payment, such as a hosted recipient at the destination address.
*/
DestinationTag?: number

FinishFunction?: string

Data?: string
}

/**
Expand Down Expand Up @@ -75,9 +79,13 @@ export function validateEscrowCreate(tx: Record<string, unknown>): void {
)
}

if (tx.FinishAfter === undefined && tx.Condition === undefined) {
if (
tx.FinishAfter === undefined &&
tx.Condition === undefined &&
tx.FinishFunction === undefined
) {
throw new ValidationError(
'EscrowCreate: Either Condition or FinishAfter must be specified',
'EscrowCreate: Either FinishAfter, Condition, or FinishFunction must be specified',
)
}

Expand Down
2 changes: 2 additions & 0 deletions packages/xrpl/src/models/transactions/escrowFinish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface EscrowFinish extends BaseTransaction {
* The credentials included must not be expired.
*/
CredentialIDs?: string[]

ComputationAllowance?: number
}

/**
Expand Down
Loading
Loading