@bananapus/nana-sdk-core 2.22.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/review/relayr.d.ts +129 -0
- package/dist/cjs/review/relayr.d.ts.map +1 -1
- package/dist/cjs/review/relayr.js +361 -17
- package/dist/cjs/review/relayr.js.map +1 -1
- package/dist/cjs/review/safeRelayr.d.ts +128 -0
- package/dist/cjs/review/safeRelayr.d.ts.map +1 -0
- package/dist/cjs/review/safeRelayr.js +645 -0
- package/dist/cjs/review/safeRelayr.js.map +1 -0
- package/dist/esm/review/relayr.d.ts +129 -0
- package/dist/esm/review/relayr.d.ts.map +1 -1
- package/dist/esm/review/relayr.js +351 -16
- package/dist/esm/review/relayr.js.map +1 -1
- package/dist/esm/review/safeRelayr.d.ts +128 -0
- package/dist/esm/review/safeRelayr.d.ts.map +1 -0
- package/dist/esm/review/safeRelayr.js +635 -0
- package/dist/esm/review/safeRelayr.js.map +1 -0
- package/package.json +6 -1
|
@@ -62,6 +62,8 @@ export declare const FORWARD_REQUEST_TYPES: {
|
|
|
62
62
|
readonly type: "bytes";
|
|
63
63
|
}];
|
|
64
64
|
};
|
|
65
|
+
/** A Relayr bundle or transaction ID, in lower case. */
|
|
66
|
+
export declare const RELAYR_UUID_RE: RegExp;
|
|
65
67
|
/** One transaction of a bundle as posted to Relayr. `value` is decimal wei. */
|
|
66
68
|
export type RelayrEntry = {
|
|
67
69
|
chain: number;
|
|
@@ -648,5 +650,132 @@ export declare function relayrSessionOutcome(verdict: RelayrRequestsVerdict, { n
|
|
|
648
650
|
nonces?: readonly string[] | null;
|
|
649
651
|
recheck?: () => Promise<void>;
|
|
650
652
|
}): Promise<RelayrSessionOutcome>;
|
|
653
|
+
/**
|
|
654
|
+
* A payment sent for a quote: the payment {@link relayrPaymentDetails}
|
|
655
|
+
* authenticated, with its amount and deadline in decimal so JSON keeps them,
|
|
656
|
+
* and the hash it was mined under.
|
|
657
|
+
*/
|
|
658
|
+
export type RelayrSentPayment = Omit<RelayrPaymentDetails, "amount" | "deadline"> & {
|
|
659
|
+
amount: string;
|
|
660
|
+
deadline: string;
|
|
661
|
+
hash: Hex;
|
|
662
|
+
};
|
|
663
|
+
/** The payment `details` describes, as a session records it once sent under `hash`. */
|
|
664
|
+
export declare function sentRelayrPayment(details: RelayrPaymentDetails, hash: Hex): RelayrSentPayment;
|
|
665
|
+
/** The most payments one quote's journal keeps. No payment is sent beyond them. */
|
|
666
|
+
export declare const MAX_RELAYR_SENT_PAYMENTS = 16;
|
|
667
|
+
/**
|
|
668
|
+
* A saved list of sent payments, read strictly: at most
|
|
669
|
+
* {@link MAX_RELAYR_SENT_PAYMENTS}, each with only a payment's own fields.
|
|
670
|
+
* Null when any of it is malformed.
|
|
671
|
+
*/
|
|
672
|
+
export declare function relayrSentPaymentsSnapshot(values: unknown): RelayrSentPayment[] | null;
|
|
673
|
+
/**
|
|
674
|
+
* The saved option a quote paid before is paid again with: exactly the one
|
|
675
|
+
* its latest payment used, on its chain with its calldata (in any case) and
|
|
676
|
+
* amount. Throws when no option is that one, and when an option on that
|
|
677
|
+
* chain with that calldata whose amount can't be read comes before it.
|
|
678
|
+
*/
|
|
679
|
+
export declare function relayrRetryOption(payments: readonly Pick<RelayrSentPayment, "chainId" | "calldata" | "amount">[] | undefined, options: readonly RelayrPayment[] | undefined): RelayrPayment;
|
|
680
|
+
/**
|
|
681
|
+
* Where a failed payment attempt leaves its quote: `reverted` when the
|
|
682
|
+
* payment reverted onchain, or when the wallet declined to pay a quote paid
|
|
683
|
+
* before, which stays on {@link requireRelayrPaymentRetry}'s rule; `unpaid`
|
|
684
|
+
* when the wallet declined its first payment; null when nothing is known, and
|
|
685
|
+
* the journal stays as it is. `sending` is whether the wallet held the
|
|
686
|
+
* payment, and `paid` whether the quote was paid before.
|
|
687
|
+
*/
|
|
688
|
+
export declare function relayrPaymentAttemptOutcome(error: unknown, { sending, paid }: {
|
|
689
|
+
sending: boolean;
|
|
690
|
+
paid: boolean;
|
|
691
|
+
}): "reverted" | "unpaid" | null;
|
|
692
|
+
/**
|
|
693
|
+
* Clear a quote paid before for one more payment, with
|
|
694
|
+
* {@link requireRelayrPaymentRetry}'s rule for each option its payments used.
|
|
695
|
+
* `payments` is every payment the session sent for the quote, as mined; those
|
|
696
|
+
* of one option (its chain, its calldata in any case, and its amount) are
|
|
697
|
+
* proven together on its chain, with `clientFor`. Before reading anything it
|
|
698
|
+
* refuses, as `invalid`, an empty list and anything
|
|
699
|
+
* {@link relayrSentPaymentsSnapshot} refuses, and a payment of another
|
|
700
|
+
* bundle; a chain without a client is `unknown`. Never pay on an error.
|
|
701
|
+
*/
|
|
702
|
+
export declare function requireRelayrRetry(clientFor: (chainId: number) => RelayrProofClient | undefined, { payments, from, bundleUuid, }: {
|
|
703
|
+
payments: readonly RelayrSentPayment[];
|
|
704
|
+
from: Address;
|
|
705
|
+
bundleUuid: string;
|
|
706
|
+
}, options?: {
|
|
707
|
+
fetch?: typeof globalThis.fetch;
|
|
708
|
+
nowSeconds?: number;
|
|
709
|
+
}): Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Prove a saved session's latest payment when it resumes, on its chain with
|
|
712
|
+
* `clientFor`. Resolves true once it succeeded onchain, and false while that
|
|
713
|
+
* can't be proven: no payment, an `account` that is not an address, no client
|
|
714
|
+
* for its chain, or a read that failed. A canonical revert runs `onReverted`
|
|
715
|
+
* and is thrown, as is any other {@link RelayrProofError}; the quote then
|
|
716
|
+
* waits on {@link requireRelayrPaymentRetry}'s rule.
|
|
717
|
+
*/
|
|
718
|
+
export declare function proveSavedRelayrPayment(clientFor: (chainId: number) => RelayrProofClient | undefined, payments: readonly RelayrSentPayment[] | undefined, account: string | null | undefined, onReverted: () => void): Promise<boolean>;
|
|
719
|
+
/**
|
|
720
|
+
* Whether the quote a session paid can still be paid at `nowMs` (the clock by
|
|
721
|
+
* default): its latest payment's deadline is more than 15 seconds away, as
|
|
722
|
+
* {@link quoteExpired} reads it and {@link requireRelayrPaymentRetry}
|
|
723
|
+
* requires. A deadline or a time that can't be read is closed.
|
|
724
|
+
*/
|
|
725
|
+
export declare function relayrPaidQuoteOpen(payments: readonly Pick<RelayrSentPayment, "deadline">[] | undefined, nowMs?: number): boolean;
|
|
726
|
+
/**
|
|
727
|
+
* Every option of a quote that {@link relayrPaymentDetails} accepts, expired
|
|
728
|
+
* or not, several on one chain included, with its details: the options a
|
|
729
|
+
* session keeps, and whose deadlines a release waits out. An option nothing
|
|
730
|
+
* can authenticate is never paid from, so it is left out.
|
|
731
|
+
*/
|
|
732
|
+
export declare function relayrQuotedOptions(quote: Pick<RelayrQuote, "bundle_uuid" | "payment_info">, destinationChainIds: readonly number[]): {
|
|
733
|
+
option: RelayrPayment;
|
|
734
|
+
details: RelayrPaymentDetails;
|
|
735
|
+
}[];
|
|
736
|
+
/**
|
|
737
|
+
* The reads a release makes on a chain: a payment's proof and a deadline at a
|
|
738
|
+
* canonical finalized block. A PublicClient for any chain satisfies it.
|
|
739
|
+
*/
|
|
740
|
+
export type RelayrReleaseClient = RelayrProofClient & Pick<RelayrFinalizedClient, "getBlock">;
|
|
741
|
+
/** A quote as a session saved it, for {@link revertedRelayrQuote}. */
|
|
742
|
+
type RevertedQuote = {
|
|
743
|
+
bundleUuid: string;
|
|
744
|
+
/** Every payment sent for the quote, as mined. */
|
|
745
|
+
payments: readonly RelayrSentPayment[];
|
|
746
|
+
/** The quote's payment options, as Relayr quoted them. */
|
|
747
|
+
options: readonly RelayrPayment[];
|
|
748
|
+
destinationChainIds: readonly number[];
|
|
749
|
+
/** The account the payments were sent from. */
|
|
750
|
+
account: string;
|
|
751
|
+
};
|
|
752
|
+
/**
|
|
753
|
+
* What a quote whose own payments reverted allows (ruling R104), from one
|
|
754
|
+
* uncached read of its bundle (with `fetch`, the global one by default):
|
|
755
|
+
*
|
|
756
|
+
* - `funded` when Relayr reports a payment, or a call running or run: another
|
|
757
|
+
* payment funded it, so its destinations are proven, never paid again;
|
|
758
|
+
* - `payable` while the quote of its latest payment is open at `nowMs` (the
|
|
759
|
+
* clock, read after the bundle, by default), for
|
|
760
|
+
* {@link requireRelayrPaymentRetry}'s rule;
|
|
761
|
+
* - `released` once nothing can fund it: every payment it sent is proven
|
|
762
|
+
* canonically reverted on its chain (with `clientFor`), every deadline of
|
|
763
|
+
* those payments and of the options {@link relayrQuotedOptions} keeps
|
|
764
|
+
* passed at a canonical finalized block, and
|
|
765
|
+
* {@link requireRelayrBundleUnpaid}, reading the bundle once more, finds it
|
|
766
|
+
* unpaid with every call pending. Its action then quotes its calls again.
|
|
767
|
+
*
|
|
768
|
+
* Throws while an expired quote's release is unproven, and, unless the
|
|
769
|
+
* bundle is funded, for a payment of another bundle or a time that can't be
|
|
770
|
+
* read. Resolves with the records Relayr reported, or null when the bundle
|
|
771
|
+
* could not be read.
|
|
772
|
+
*/
|
|
773
|
+
export declare function revertedRelayrQuote(clientFor: (chainId: number) => RelayrReleaseClient | undefined, quote: RevertedQuote, { fetch: fetchBundle, nowMs, }?: {
|
|
774
|
+
fetch?: typeof globalThis.fetch;
|
|
775
|
+
nowMs?: number;
|
|
776
|
+
}): Promise<{
|
|
777
|
+
state: "funded" | "payable" | "released";
|
|
778
|
+
records: RelayrTransactionRecord[] | null;
|
|
779
|
+
}>;
|
|
651
780
|
export {};
|
|
652
781
|
//# sourceMappingURL=relayr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayr.d.ts","sourceRoot":"","sources":["../../../src/review/relayr.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAWlC,yBAAyB;AACzB,eAAO,MAAM,UAAU,iCAAiC,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAC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AyFF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,mBAAmB,GAAG,SAAS,EAC/D,KAAK,EAAE,aAAa,EACpB,EACE,KAAK,EAAE,WAA8B,EACrC,KAAK,GACN,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1D,OAAO,CAAC;IACT,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IACzC,OAAO,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;CAC3C,CAAC,CAmCD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RelayrPaymentRetryError = exports.RelayrDestinationRevertedError = exports.RelayrPaymentRevertedError = exports.RelayrProofError = exports.FORWARD_REQUEST_TYPES = exports.TRUSTED_FORWARDER_ABI = exports.RELAYR_FORWARDER_DEADLINE_SECONDS = exports.RELAYR_PAYMENT_GAS = exports.RELAYR_NATIVE_TOKEN = exports.RELAYR_PAYMENT_CODE_HASH = exports.RELAYR_PAYMENT_SELECTOR = exports.RELAYR_PAYMENT_ADDRESS = exports.RELAYR_API = void 0;
|
|
3
|
+
exports.MAX_RELAYR_SENT_PAYMENTS = exports.RelayrPaymentRetryError = exports.RelayrDestinationRevertedError = exports.RelayrPaymentRevertedError = exports.RelayrProofError = exports.RELAYR_UUID_RE = exports.FORWARD_REQUEST_TYPES = exports.TRUSTED_FORWARDER_ABI = exports.RELAYR_FORWARDER_DEADLINE_SECONDS = exports.RELAYR_PAYMENT_GAS = exports.RELAYR_NATIVE_TOKEN = exports.RELAYR_PAYMENT_CODE_HASH = exports.RELAYR_PAYMENT_SELECTOR = exports.RELAYR_PAYMENT_ADDRESS = exports.RELAYR_API = void 0;
|
|
4
4
|
exports.relayrSupportsChain = relayrSupportsChain;
|
|
5
5
|
exports.relayrSupportsChains = relayrSupportsChains;
|
|
6
6
|
exports.relayrPaymentChains = relayrPaymentChains;
|
|
@@ -31,9 +31,19 @@ exports.relayrRequestsDead = relayrRequestsDead;
|
|
|
31
31
|
exports.relayrDeadlinePassed = relayrDeadlinePassed;
|
|
32
32
|
exports.isRelayrDiscardReason = isRelayrDiscardReason;
|
|
33
33
|
exports.relayrSessionOutcome = relayrSessionOutcome;
|
|
34
|
+
exports.sentRelayrPayment = sentRelayrPayment;
|
|
35
|
+
exports.relayrSentPaymentsSnapshot = relayrSentPaymentsSnapshot;
|
|
36
|
+
exports.relayrRetryOption = relayrRetryOption;
|
|
37
|
+
exports.relayrPaymentAttemptOutcome = relayrPaymentAttemptOutcome;
|
|
38
|
+
exports.requireRelayrRetry = requireRelayrRetry;
|
|
39
|
+
exports.proveSavedRelayrPayment = proveSavedRelayrPayment;
|
|
40
|
+
exports.relayrPaidQuoteOpen = relayrPaidQuoteOpen;
|
|
41
|
+
exports.relayrQuotedOptions = relayrQuotedOptions;
|
|
42
|
+
exports.revertedRelayrQuote = revertedRelayrQuote;
|
|
34
43
|
const viem_1 = require("viem");
|
|
35
44
|
const juicebox_js_1 = require("../generated/juicebox.js");
|
|
36
45
|
const untrusted_js_1 = require("../untrusted.js");
|
|
46
|
+
const contractWrite_js_1 = require("./contractWrite.js");
|
|
37
47
|
const simulation_js_1 = require("./simulation.js");
|
|
38
48
|
// Relayr runs a bundle of transactions on several chains for one prepaid
|
|
39
49
|
// native payment on one of them. Everything its API returns is untrusted:
|
|
@@ -92,7 +102,8 @@ const TESTNETS = [11155111, 11155420, 84532, 421614];
|
|
|
92
102
|
const PAYMENT_CODE_MAX_BYTES = 2_048;
|
|
93
103
|
const BUNDLE_READ_TIMEOUT_MS = 15_000;
|
|
94
104
|
const HTTP_DETAIL_CHARACTERS = 240;
|
|
95
|
-
|
|
105
|
+
/** A Relayr bundle or transaction ID, in lower case. */
|
|
106
|
+
exports.RELAYR_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
96
107
|
// RFC 3339 with an explicit offset. A time without one is read in the
|
|
97
108
|
// machine's timezone, which would make the same quote pass or fail by place.
|
|
98
109
|
const DEADLINE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/iu;
|
|
@@ -102,6 +113,7 @@ const NO_PROOF = "This saved Relayr bundle lacks exact destination proof. Keep i
|
|
|
102
113
|
const NOT_IDENTIFIED = "Relayr has not identified every exact destination transaction. Keep checking the original bundle; do not pay again.";
|
|
103
114
|
const EXPIRED = "This Relayr quote expired. Review the action again for a new quote.";
|
|
104
115
|
const UNKNOWN_PAYMENT = "Relayr has not said whether this bundle is paid. Do not pay again yet; check it later.";
|
|
116
|
+
const UNNAMED = "Name every payment this session sent for the quote before paying it again.";
|
|
105
117
|
const UNVERIFIABLE = "Only an authenticated Relayr payment with its transaction hash can be verified.";
|
|
106
118
|
/**
|
|
107
119
|
* The chain or Relayr contradicts the expected transaction: this evidence can
|
|
@@ -196,7 +208,7 @@ function uuidOf(value) {
|
|
|
196
208
|
if (typeof value !== "string")
|
|
197
209
|
return null;
|
|
198
210
|
const uuid = value.toLowerCase();
|
|
199
|
-
return
|
|
211
|
+
return exports.RELAYR_UUID_RE.test(uuid) ? uuid : null;
|
|
200
212
|
}
|
|
201
213
|
function readEntry(entry) {
|
|
202
214
|
if (!entry || typeof entry !== "object")
|
|
@@ -833,7 +845,7 @@ async function verifyRelayrPayment(client, { hash, from, payment, }) {
|
|
|
833
845
|
*/
|
|
834
846
|
async function requireRelayrPaymentRetry(client, { hashes, from, payment, }, { fetch: fetchBundle = globalThis.fetch, nowSeconds = Date.now() / 1_000, } = {}) {
|
|
835
847
|
if (!Array.isArray(hashes) || !hashes.length) {
|
|
836
|
-
throw new RelayrPaymentRetryError(
|
|
848
|
+
throw new RelayrPaymentRetryError(UNNAMED, "invalid");
|
|
837
849
|
}
|
|
838
850
|
const reviewed = verifiablePayment(hashes, from, payment);
|
|
839
851
|
if (!reviewed)
|
|
@@ -875,6 +887,11 @@ async function requireRelayrBundleUnpaid(bundleUuid, { fetch: fetchBundle = glob
|
|
|
875
887
|
}
|
|
876
888
|
requireUnpaidBundle(await readBundle(fetchBundle, uuid, () => new RelayrPaymentRetryError(UNKNOWN_PAYMENT, "unknown")));
|
|
877
889
|
}
|
|
890
|
+
/** Relayr has not run the call: `pending`, in any case, with no destination hash. */
|
|
891
|
+
function relayrRecordPending(record) {
|
|
892
|
+
return (relayrDestinationHash(record) === null &&
|
|
893
|
+
relayrStateIsPending(record?.status?.state));
|
|
894
|
+
}
|
|
878
895
|
/** {@link requireRelayrBundleUnpaid}'s check of a bundle already read. */
|
|
879
896
|
function requireUnpaidBundle({ payment_received, transactions, }) {
|
|
880
897
|
if (payment_received === true) {
|
|
@@ -885,8 +902,7 @@ function requireUnpaidBundle({ payment_received, transactions, }) {
|
|
|
885
902
|
!transactions.length) {
|
|
886
903
|
throw new RelayrPaymentRetryError(UNKNOWN_PAYMENT, "unknown");
|
|
887
904
|
}
|
|
888
|
-
if (transactions.some((record) =>
|
|
889
|
-
!relayrStateIsPending(record?.status?.state))) {
|
|
905
|
+
if (transactions.some((record) => !relayrRecordPending(record))) {
|
|
890
906
|
throw new RelayrPaymentRetryError("Relayr reports a transaction of this bundle as running or run. Do not pay again.", "running");
|
|
891
907
|
}
|
|
892
908
|
}
|
|
@@ -1024,6 +1040,15 @@ async function atCanonicalFinalizedBlock(client, read) {
|
|
|
1024
1040
|
return null;
|
|
1025
1041
|
}
|
|
1026
1042
|
}
|
|
1043
|
+
/** `clientFor(chainId)`, or none when it has none or throws. */
|
|
1044
|
+
function clientOn(clientFor, chainId) {
|
|
1045
|
+
try {
|
|
1046
|
+
return clientFor(chainId);
|
|
1047
|
+
}
|
|
1048
|
+
catch {
|
|
1049
|
+
return undefined;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1027
1052
|
/**
|
|
1028
1053
|
* The nonce the canonical forwarder on `chainId` expects next from `signer`
|
|
1029
1054
|
* at the chain's finalized block, still canonical, with that block's
|
|
@@ -1031,18 +1056,11 @@ async function atCanonicalFinalizedBlock(client, read) {
|
|
|
1031
1056
|
*/
|
|
1032
1057
|
async function finalizedForwarderNonce(clientFor, chainId, signer) {
|
|
1033
1058
|
const forwarder = forwarderOn(chainId);
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
client = clientFor(chainId);
|
|
1039
|
-
}
|
|
1040
|
-
catch {
|
|
1041
|
-
return null;
|
|
1042
|
-
}
|
|
1043
|
-
if (!client)
|
|
1059
|
+
const reader = forwarder && isAddressLike(signer)
|
|
1060
|
+
? clientOn(clientFor, chainId)
|
|
1061
|
+
: undefined;
|
|
1062
|
+
if (!forwarder || !reader)
|
|
1044
1063
|
return null;
|
|
1045
|
-
const reader = client;
|
|
1046
1064
|
const finalized = await atCanonicalFinalizedBlock(reader, (blockNumber) => reader.readContract({
|
|
1047
1065
|
address: forwarder,
|
|
1048
1066
|
abi: juicebox_js_1.erc2771ForwarderAbi,
|
|
@@ -1243,4 +1261,330 @@ async function relayrSessionOutcome(verdict, { nonces, recheck, } = {}) {
|
|
|
1243
1261
|
}
|
|
1244
1262
|
return { kind: "re-sign", nonces: saved };
|
|
1245
1263
|
}
|
|
1264
|
+
/** The payment `details` describes, as a session records it once sent under `hash`. */
|
|
1265
|
+
function sentRelayrPayment(details, hash) {
|
|
1266
|
+
return {
|
|
1267
|
+
...details,
|
|
1268
|
+
amount: details.amount.toString(),
|
|
1269
|
+
deadline: details.deadline.toString(),
|
|
1270
|
+
hash,
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
/** The most payments one quote's journal keeps. No payment is sent beyond them. */
|
|
1274
|
+
exports.MAX_RELAYR_SENT_PAYMENTS = 16;
|
|
1275
|
+
/**
|
|
1276
|
+
* A saved sent payment, read strictly, or null. Its deadline must be the one
|
|
1277
|
+
* its calldata pays until, which the payment's proof binds onchain.
|
|
1278
|
+
*/
|
|
1279
|
+
function relayrSentPaymentSnapshot(value) {
|
|
1280
|
+
if (!value || typeof value !== "object")
|
|
1281
|
+
return null;
|
|
1282
|
+
const { hash, chainId, target, calldata, amount, deadline, bundleUuid } = value;
|
|
1283
|
+
return (0, untrusted_js_1.isBytes32)(hash) &&
|
|
1284
|
+
typeof chainId === "number" &&
|
|
1285
|
+
relayrSupportsChain(chainId) &&
|
|
1286
|
+
isStrictAddress(target) &&
|
|
1287
|
+
typeof calldata === "string" &&
|
|
1288
|
+
/^0x[0-9a-f]{136}$/iu.test(calldata) &&
|
|
1289
|
+
typeof amount === "string" &&
|
|
1290
|
+
/^\d{1,78}$/u.test(amount) &&
|
|
1291
|
+
typeof deadline === "string" &&
|
|
1292
|
+
/^\d{1,13}$/u.test(deadline) &&
|
|
1293
|
+
typeof bundleUuid === "string" &&
|
|
1294
|
+
exports.RELAYR_UUID_RE.test(bundleUuid) &&
|
|
1295
|
+
BigInt(deadline) === calldataDeadline(calldata)
|
|
1296
|
+
? {
|
|
1297
|
+
hash,
|
|
1298
|
+
chainId,
|
|
1299
|
+
target,
|
|
1300
|
+
calldata: calldata,
|
|
1301
|
+
amount,
|
|
1302
|
+
deadline,
|
|
1303
|
+
bundleUuid,
|
|
1304
|
+
}
|
|
1305
|
+
: null;
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* A saved list of sent payments, read strictly: at most
|
|
1309
|
+
* {@link MAX_RELAYR_SENT_PAYMENTS}, each with only a payment's own fields.
|
|
1310
|
+
* Null when any of it is malformed.
|
|
1311
|
+
*/
|
|
1312
|
+
function relayrSentPaymentsSnapshot(values) {
|
|
1313
|
+
if (!Array.isArray(values) || values.length > exports.MAX_RELAYR_SENT_PAYMENTS) {
|
|
1314
|
+
return null;
|
|
1315
|
+
}
|
|
1316
|
+
const payments = values.map(relayrSentPaymentSnapshot);
|
|
1317
|
+
return payments.every((payment) => payment !== null)
|
|
1318
|
+
? payments
|
|
1319
|
+
: null;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* The saved option a quote paid before is paid again with: exactly the one
|
|
1323
|
+
* its latest payment used, on its chain with its calldata (in any case) and
|
|
1324
|
+
* amount. Throws when no option is that one, and when an option on that
|
|
1325
|
+
* chain with that calldata whose amount can't be read comes before it.
|
|
1326
|
+
*/
|
|
1327
|
+
function relayrRetryOption(payments, options) {
|
|
1328
|
+
const latest = Array.isArray(payments)
|
|
1329
|
+
? payments[payments.length - 1]
|
|
1330
|
+
: undefined;
|
|
1331
|
+
let option;
|
|
1332
|
+
if (latest && Array.isArray(options)) {
|
|
1333
|
+
for (const item of options) {
|
|
1334
|
+
if (item.chain !== latest.chainId ||
|
|
1335
|
+
typeof item.calldata !== "string" ||
|
|
1336
|
+
item.calldata.toLowerCase() !== latest.calldata.toLowerCase() ||
|
|
1337
|
+
typeof item.amount !== "string") {
|
|
1338
|
+
continue;
|
|
1339
|
+
}
|
|
1340
|
+
// An earlier twin whose amount can't be read ends the search, refused.
|
|
1341
|
+
const amount = (0, untrusted_js_1.uint256)(item.amount);
|
|
1342
|
+
if (amount === null)
|
|
1343
|
+
break;
|
|
1344
|
+
if (amount === (0, untrusted_js_1.uint256)(latest.amount)) {
|
|
1345
|
+
option = item;
|
|
1346
|
+
break;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
if (!option) {
|
|
1351
|
+
throw new Error("This Relayr quote cannot be paid again from its saved record. Keep it pending; do not pay again.");
|
|
1352
|
+
}
|
|
1353
|
+
return option;
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Where a failed payment attempt leaves its quote: `reverted` when the
|
|
1357
|
+
* payment reverted onchain, or when the wallet declined to pay a quote paid
|
|
1358
|
+
* before, which stays on {@link requireRelayrPaymentRetry}'s rule; `unpaid`
|
|
1359
|
+
* when the wallet declined its first payment; null when nothing is known, and
|
|
1360
|
+
* the journal stays as it is. `sending` is whether the wallet held the
|
|
1361
|
+
* payment, and `paid` whether the quote was paid before.
|
|
1362
|
+
*/
|
|
1363
|
+
function relayrPaymentAttemptOutcome(error, { sending, paid }) {
|
|
1364
|
+
if (error instanceof RelayrPaymentRevertedError)
|
|
1365
|
+
return "reverted";
|
|
1366
|
+
if (sending && (0, contractWrite_js_1.isDefiniteWalletRejection)(error)) {
|
|
1367
|
+
return paid ? "reverted" : "unpaid";
|
|
1368
|
+
}
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Clear a quote paid before for one more payment, with
|
|
1373
|
+
* {@link requireRelayrPaymentRetry}'s rule for each option its payments used.
|
|
1374
|
+
* `payments` is every payment the session sent for the quote, as mined; those
|
|
1375
|
+
* of one option (its chain, its calldata in any case, and its amount) are
|
|
1376
|
+
* proven together on its chain, with `clientFor`. Before reading anything it
|
|
1377
|
+
* refuses, as `invalid`, an empty list and anything
|
|
1378
|
+
* {@link relayrSentPaymentsSnapshot} refuses, and a payment of another
|
|
1379
|
+
* bundle; a chain without a client is `unknown`. Never pay on an error.
|
|
1380
|
+
*/
|
|
1381
|
+
async function requireRelayrRetry(clientFor, { payments, from, bundleUuid, }, options = {}) {
|
|
1382
|
+
if (!Array.isArray(payments) || !payments.length) {
|
|
1383
|
+
throw new RelayrPaymentRetryError(UNNAMED, "invalid");
|
|
1384
|
+
}
|
|
1385
|
+
const sent = relayrSentPaymentsSnapshot(payments);
|
|
1386
|
+
if (!sent)
|
|
1387
|
+
throw new RelayrPaymentRetryError(UNVERIFIABLE, "invalid");
|
|
1388
|
+
if (sent.some((payment) => payment.bundleUuid !== bundleUuid)) {
|
|
1389
|
+
throw new Error("A saved Relayr payment belongs to another bundle. Do not pay again; check the original bundle.");
|
|
1390
|
+
}
|
|
1391
|
+
const byPayment = new Map();
|
|
1392
|
+
for (const payment of sent) {
|
|
1393
|
+
const key = `${payment.chainId}:${payment.calldata.toLowerCase()}:${payment.amount}`;
|
|
1394
|
+
const group = byPayment.get(key) ?? { payment, hashes: [] };
|
|
1395
|
+
group.hashes.push(payment.hash);
|
|
1396
|
+
byPayment.set(key, group);
|
|
1397
|
+
}
|
|
1398
|
+
for (const { payment, hashes } of byPayment.values()) {
|
|
1399
|
+
const client = clientOn(clientFor, payment.chainId);
|
|
1400
|
+
if (!client) {
|
|
1401
|
+
throw new RelayrPaymentRetryError(`No RPC is available for chain ${payment.chainId}. Do not pay again yet; check it later.`, "unknown");
|
|
1402
|
+
}
|
|
1403
|
+
await requireRelayrPaymentRetry(client, { hashes, from, payment }, options);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Prove a saved session's latest payment when it resumes, on its chain with
|
|
1408
|
+
* `clientFor`. Resolves true once it succeeded onchain, and false while that
|
|
1409
|
+
* can't be proven: no payment, an `account` that is not an address, no client
|
|
1410
|
+
* for its chain, or a read that failed. A canonical revert runs `onReverted`
|
|
1411
|
+
* and is thrown, as is any other {@link RelayrProofError}; the quote then
|
|
1412
|
+
* waits on {@link requireRelayrPaymentRetry}'s rule.
|
|
1413
|
+
*/
|
|
1414
|
+
async function proveSavedRelayrPayment(clientFor, payments, account, onReverted) {
|
|
1415
|
+
const latest = Array.isArray(payments)
|
|
1416
|
+
? payments[payments.length - 1]
|
|
1417
|
+
: undefined;
|
|
1418
|
+
if (!latest || !isStrictAddress(account))
|
|
1419
|
+
return false;
|
|
1420
|
+
const client = clientOn(clientFor, latest.chainId);
|
|
1421
|
+
if (!client)
|
|
1422
|
+
return false;
|
|
1423
|
+
try {
|
|
1424
|
+
await verifyRelayrPayment(client, {
|
|
1425
|
+
hash: latest.hash,
|
|
1426
|
+
from: account,
|
|
1427
|
+
payment: latest,
|
|
1428
|
+
});
|
|
1429
|
+
return true;
|
|
1430
|
+
}
|
|
1431
|
+
catch (error) {
|
|
1432
|
+
if (error instanceof RelayrPaymentRevertedError)
|
|
1433
|
+
onReverted();
|
|
1434
|
+
if (error instanceof RelayrProofError)
|
|
1435
|
+
throw error;
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Whether the quote a session paid can still be paid at `nowMs` (the clock by
|
|
1441
|
+
* default): its latest payment's deadline is more than 15 seconds away, as
|
|
1442
|
+
* {@link quoteExpired} reads it and {@link requireRelayrPaymentRetry}
|
|
1443
|
+
* requires. A deadline or a time that can't be read is closed.
|
|
1444
|
+
*/
|
|
1445
|
+
function relayrPaidQuoteOpen(payments, nowMs = Date.now()) {
|
|
1446
|
+
const latest = Array.isArray(payments)
|
|
1447
|
+
? payments[payments.length - 1]
|
|
1448
|
+
: undefined;
|
|
1449
|
+
const deadline = latest ? (0, untrusted_js_1.uint256)(latest.deadline) : null;
|
|
1450
|
+
return (deadline !== null &&
|
|
1451
|
+
Number.isFinite(nowMs) &&
|
|
1452
|
+
!quoteExpired(deadline, nowMs / 1_000));
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Every option of a quote that {@link relayrPaymentDetails} accepts, expired
|
|
1456
|
+
* or not, several on one chain included, with its details: the options a
|
|
1457
|
+
* session keeps, and whose deadlines a release waits out. An option nothing
|
|
1458
|
+
* can authenticate is never paid from, so it is left out.
|
|
1459
|
+
*/
|
|
1460
|
+
function relayrQuotedOptions(quote, destinationChainIds) {
|
|
1461
|
+
return (Array.isArray(quote.payment_info) ? quote.payment_info : []).flatMap((option) => {
|
|
1462
|
+
try {
|
|
1463
|
+
return [
|
|
1464
|
+
{
|
|
1465
|
+
option,
|
|
1466
|
+
details: relayrPaymentDetails(option, {
|
|
1467
|
+
bundleUuid: quote.bundle_uuid,
|
|
1468
|
+
destinationChainIds,
|
|
1469
|
+
nowSeconds: 0,
|
|
1470
|
+
}),
|
|
1471
|
+
},
|
|
1472
|
+
];
|
|
1473
|
+
}
|
|
1474
|
+
catch {
|
|
1475
|
+
return [];
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
/** One uncached read of the bundle, or null when it can't be read, names another bundle or lists no calls. */
|
|
1480
|
+
async function relayrBundleIfNamed(bundleUuid, fetchBundle) {
|
|
1481
|
+
try {
|
|
1482
|
+
const { payment_received, transactions } = await readRelayrBundle(bundleUuid, { fetch: fetchBundle });
|
|
1483
|
+
return Array.isArray(transactions)
|
|
1484
|
+
? { paymentReceived: payment_received, records: transactions }
|
|
1485
|
+
: null;
|
|
1486
|
+
}
|
|
1487
|
+
catch {
|
|
1488
|
+
return null;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Nothing can fund the quote any more: every payment it sent is proven
|
|
1493
|
+
* canonically reverted, and the deadline of each of those payments, and of
|
|
1494
|
+
* each option {@link relayrQuotedOptions} keeps, has passed at a canonical
|
|
1495
|
+
* finalized block on its chain. Anything unread is false.
|
|
1496
|
+
*/
|
|
1497
|
+
async function relayrQuoteUnfundable(clientFor, { payments, options, bundleUuid, destinationChainIds, account, }) {
|
|
1498
|
+
if (!Array.isArray(payments) ||
|
|
1499
|
+
!payments.length ||
|
|
1500
|
+
!Array.isArray(options) ||
|
|
1501
|
+
!isStrictAddress(account)) {
|
|
1502
|
+
return false;
|
|
1503
|
+
}
|
|
1504
|
+
for (const payment of payments) {
|
|
1505
|
+
const client = clientOn(clientFor, payment.chainId);
|
|
1506
|
+
if (!client)
|
|
1507
|
+
return false;
|
|
1508
|
+
try {
|
|
1509
|
+
await verifyRelayrPayment(client, {
|
|
1510
|
+
hash: payment.hash,
|
|
1511
|
+
from: account,
|
|
1512
|
+
payment,
|
|
1513
|
+
});
|
|
1514
|
+
return false;
|
|
1515
|
+
}
|
|
1516
|
+
catch (error) {
|
|
1517
|
+
if (!(error instanceof RelayrPaymentRevertedError))
|
|
1518
|
+
return false;
|
|
1519
|
+
}
|
|
1520
|
+
// The proof read the calldata's deadline word; the saved one must be it.
|
|
1521
|
+
if ((0, untrusted_js_1.uint256)(payment.deadline) !== calldataDeadline(payment.calldata)) {
|
|
1522
|
+
return false;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
const deadlines = new Map(payments.map((payment) => [
|
|
1526
|
+
`${payment.chainId}:${payment.deadline}`,
|
|
1527
|
+
payment,
|
|
1528
|
+
]));
|
|
1529
|
+
for (const { details } of relayrQuotedOptions({ bundle_uuid: bundleUuid, payment_info: [...options] }, destinationChainIds)) {
|
|
1530
|
+
deadlines.set(`${details.chainId}:${details.deadline}`, {
|
|
1531
|
+
chainId: details.chainId,
|
|
1532
|
+
deadline: details.deadline.toString(),
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
for (const { chainId, deadline } of deadlines.values()) {
|
|
1536
|
+
const client = clientOn(clientFor, chainId);
|
|
1537
|
+
if (!client || !(await relayrDeadlinePassed(client, deadline))) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
return true;
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* What a quote whose own payments reverted allows (ruling R104), from one
|
|
1545
|
+
* uncached read of its bundle (with `fetch`, the global one by default):
|
|
1546
|
+
*
|
|
1547
|
+
* - `funded` when Relayr reports a payment, or a call running or run: another
|
|
1548
|
+
* payment funded it, so its destinations are proven, never paid again;
|
|
1549
|
+
* - `payable` while the quote of its latest payment is open at `nowMs` (the
|
|
1550
|
+
* clock, read after the bundle, by default), for
|
|
1551
|
+
* {@link requireRelayrPaymentRetry}'s rule;
|
|
1552
|
+
* - `released` once nothing can fund it: every payment it sent is proven
|
|
1553
|
+
* canonically reverted on its chain (with `clientFor`), every deadline of
|
|
1554
|
+
* those payments and of the options {@link relayrQuotedOptions} keeps
|
|
1555
|
+
* passed at a canonical finalized block, and
|
|
1556
|
+
* {@link requireRelayrBundleUnpaid}, reading the bundle once more, finds it
|
|
1557
|
+
* unpaid with every call pending. Its action then quotes its calls again.
|
|
1558
|
+
*
|
|
1559
|
+
* Throws while an expired quote's release is unproven, and, unless the
|
|
1560
|
+
* bundle is funded, for a payment of another bundle or a time that can't be
|
|
1561
|
+
* read. Resolves with the records Relayr reported, or null when the bundle
|
|
1562
|
+
* could not be read.
|
|
1563
|
+
*/
|
|
1564
|
+
async function revertedRelayrQuote(clientFor, quote, { fetch: fetchBundle = globalThis.fetch, nowMs, } = {}) {
|
|
1565
|
+
const bundle = await relayrBundleIfNamed(quote.bundleUuid, fetchBundle);
|
|
1566
|
+
const records = bundle?.records ?? null;
|
|
1567
|
+
if (bundle &&
|
|
1568
|
+
(bundle.paymentReceived === true ||
|
|
1569
|
+
bundle.records.some((record) => !relayrRecordPending(record)))) {
|
|
1570
|
+
return { state: "funded", records };
|
|
1571
|
+
}
|
|
1572
|
+
// The clock is read after the bundle, whose read can take a while.
|
|
1573
|
+
const now = nowMs ?? Date.now();
|
|
1574
|
+
const ownPayments = Array.isArray(quote.payments) &&
|
|
1575
|
+
quote.payments.every((payment) => payment?.bundleUuid === quote.bundleUuid);
|
|
1576
|
+
if (ownPayments && Number.isFinite(now)) {
|
|
1577
|
+
if (relayrPaidQuoteOpen(quote.payments, now)) {
|
|
1578
|
+
return { state: "payable", records };
|
|
1579
|
+
}
|
|
1580
|
+
if (bundle &&
|
|
1581
|
+
(await relayrQuoteUnfundable(clientFor, quote)) &&
|
|
1582
|
+
(await requireRelayrBundleUnpaid(quote.bundleUuid, {
|
|
1583
|
+
fetch: fetchBundle,
|
|
1584
|
+
}).then(() => true, () => false))) {
|
|
1585
|
+
return { state: "released", records };
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
throw new Error("This Relayr quote expired after its payment reverted. A new quote needs its deadline final onchain and Relayr to report nothing ran; try again in a few minutes.");
|
|
1589
|
+
}
|
|
1246
1590
|
//# sourceMappingURL=relayr.js.map
|