@sorandomains/owner 0.8.0 → 0.10.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.
@@ -0,0 +1,133 @@
1
+ import { TestnetSponsorHistory, sponsorRpcReceipt, } from "./funding-history.js";
2
+ import { claimIntentToScVal } from "./native-types.js";
3
+ import { FundingError, decodeSponsorQuote, sponsoredIdentityToScVal, sponsorIntentHash, } from "./funding-types.js";
4
+ /** HTTP transports offers and status. The contract/RPC checks still authorize spending. */
5
+ export class FundingServiceClient {
6
+ client;
7
+ request;
8
+ history;
9
+ base;
10
+ constructor(baseUrl, client, request = (input, init) => globalThis.fetch(input, init), history = new TestnetSponsorHistory()) {
11
+ this.client = client;
12
+ this.request = request;
13
+ this.history = history;
14
+ const url = new URL(baseUrl);
15
+ if (url.username ||
16
+ url.password ||
17
+ url.hash ||
18
+ url.search ||
19
+ (url.protocol !== "https:" &&
20
+ !(url.protocol === "http:" &&
21
+ ["localhost", "127.0.0.1"].includes(url.hostname))))
22
+ throw new FundingError("Sponsorship API must use HTTPS or a local development endpoint");
23
+ this.base = url.toString().replace(/\/$/, "");
24
+ }
25
+ async call(path, body) {
26
+ let r;
27
+ try {
28
+ r = await this.request(this.base + path, {
29
+ method: body === undefined ? "GET" : "POST",
30
+ headers: body === undefined
31
+ ? undefined
32
+ : { "content-type": "application/json" },
33
+ body: body === undefined ? undefined : JSON.stringify(body),
34
+ signal: AbortSignal.timeout(30000),
35
+ redirect: "error",
36
+ });
37
+ }
38
+ catch {
39
+ throw new FundingError("Service response unavailable. Keep your quote reference and recover its status before submitting again.", "unavailable");
40
+ }
41
+ const value = (await r.json());
42
+ if (!value || typeof value !== "object" || Array.isArray(value))
43
+ throw new FundingError("Invalid service response", "unavailable");
44
+ if (!r.ok || value.error)
45
+ throw new FundingError(typeof value.detail === "string"
46
+ ? value.detail
47
+ : "Sponsorship request stopped", value.error === "pending" ? "pending" : "unavailable", typeof value.transactionHash === "string"
48
+ ? value.transactionHash
49
+ : null);
50
+ return value;
51
+ }
52
+ async quote(action, intent, maxSponsorCharge, proof = []) {
53
+ const encoded = action === "claim"
54
+ ? claimIntentToScVal(intent)
55
+ : sponsoredIdentityToScVal(intent);
56
+ const offer = await this.call("/v1/sponsorship/quote", {
57
+ action,
58
+ intentXdr: encoded.toXDR("base64"),
59
+ proof,
60
+ });
61
+ return this.reviewOffer(offer, action, intent, maxSponsorCharge, proof);
62
+ }
63
+ /** Re-estimate with the previous, valid wallet authorization. This never
64
+ * submits; review the new charge and call authorize again before submit. */
65
+ async refreshQuote(request, authorizedTransactionXdr, maxSponsorCharge) {
66
+ this.id(request.quote.quoteId);
67
+ const offer = await this.call("/v1/sponsorship/requote", {
68
+ quoteId: request.quote.quoteId, transactionXdr: authorizedTransactionXdr,
69
+ });
70
+ return this.reviewOffer(offer, request.quote.action, request.intent, maxSponsorCharge, request.proof ?? []);
71
+ }
72
+ async reviewOffer(offer, action, intent, maxSponsorCharge, proof) {
73
+ const quote = decodeSponsorQuote(offer.quoteXdr);
74
+ if (offer.id !== quote.quoteId ||
75
+ quote.action !== action ||
76
+ quote.intentHash !== sponsorIntentHash(action, intent) ||
77
+ quote.charge > maxSponsorCharge ||
78
+ typeof offer.transactionXdr !== "string" ||
79
+ offer.transactionXdr.length > 100000)
80
+ throw new FundingError("Sponsorship offer differs from the action or charge you reviewed", "authorization");
81
+ await this.client.validateQuote(quote);
82
+ return {
83
+ request: { quote, intent, proof },
84
+ transactionXdr: offer.transactionXdr,
85
+ };
86
+ }
87
+ async submit(quote, authorizedTransactionXdr) {
88
+ this.id(quote.quoteId);
89
+ const result = await this.call("/v1/sponsorship/submit", {
90
+ quoteId: quote.quoteId,
91
+ transactionXdr: authorizedTransactionXdr,
92
+ });
93
+ return this.result(quote, result);
94
+ }
95
+ async status(quote) {
96
+ this.id(quote.quoteId);
97
+ return this.result(quote, await this.call(`/v1/sponsorship/status/${quote.quoteId}`));
98
+ }
99
+ id(id) {
100
+ if (!/^[a-f0-9]{64}$/.test(id))
101
+ throw new FundingError("Invalid quote ID");
102
+ }
103
+ async result(quote, value) {
104
+ if (value.id !== quote.quoteId ||
105
+ quote.funding !== this.client.fundingId ||
106
+ quote.network !== this.client.networkId ||
107
+ ![
108
+ "quoted",
109
+ "dispatching",
110
+ "pending",
111
+ "unknown",
112
+ "success",
113
+ "failed",
114
+ "expired",
115
+ ].includes(value.status) ||
116
+ (value.transactionHash !== null &&
117
+ !/^[a-f0-9]{64}$/.test(value.transactionHash)))
118
+ throw new FundingError("Unverifiable sponsorship status; preserve the original quote reference", "unavailable");
119
+ if (value.status === "success" || value.status === "failed") {
120
+ if (!value.transactionHash)
121
+ throw new FundingError("Missing confirmed transaction hash", "unavailable");
122
+ const result = await this.client.server.getTransaction(value.transactionHash);
123
+ const receipt = result.status === "SUCCESS" || result.status === "FAILED"
124
+ ? sponsorRpcReceipt(result, quote, value.transactionHash, this.client.passphrase)
125
+ : await this.history.find(value.transactionHash, quote, (await this.client.server.getLatestLedger()).sequence, this.client.passphrase);
126
+ // Fetch independently from a trusted chain provider. API receipt bytes or
127
+ // a persisted status alone cannot establish canonical inclusion.
128
+ if (!receipt || receipt.status !== value.status)
129
+ throw new FundingError("Service outcome is not confirmed by chain history", "pending", value.transactionHash);
130
+ }
131
+ return value;
132
+ }
133
+ }
@@ -0,0 +1,102 @@
1
+ import { xdr } from "@stellar/stellar-sdk";
2
+ import { type PaymentDestination } from "./payment.js";
3
+ import { type ClaimIntent } from "./native-types.js";
4
+ export declare class FundingError extends Error {
5
+ readonly kind: "invalid" | "unavailable" | "authorization" | "pending" | "failed";
6
+ readonly transactionHash: string | null;
7
+ constructor(message: string, kind?: "invalid" | "unavailable" | "authorization" | "pending" | "failed", transactionHash?: string | null);
8
+ }
9
+ export type SponsoredAction = "claim" | "reverse" | "primary";
10
+ export type FundingConfiguration = {
11
+ registry: string;
12
+ nativeAsset: string;
13
+ lookup: string;
14
+ primary: string;
15
+ governance: string;
16
+ paused: boolean;
17
+ revision: bigint;
18
+ };
19
+ export type FundingPosition = {
20
+ namespace: string;
21
+ ownerEpoch: bigint;
22
+ controller: string;
23
+ balance: bigint;
24
+ spentTotal: bigint;
25
+ utcDay: bigint;
26
+ spentToday: bigint;
27
+ policyRevision: bigint;
28
+ status: "paused" | "active" | "closed";
29
+ };
30
+ export type SponsorPolicy = {
31
+ claimCap: bigint;
32
+ reverseCap: bigint;
33
+ primaryCap: bigint;
34
+ dailyCap: bigint;
35
+ totalCap: bigint;
36
+ claimsPerWallet: bigint;
37
+ identityPerDay: number;
38
+ relayer: string;
39
+ quoteLifetime: number;
40
+ validUntil: bigint;
41
+ };
42
+ export type SponsorQuote = {
43
+ network: string;
44
+ funding: string;
45
+ configRevision: bigint;
46
+ fundId: string;
47
+ policyRevision: bigint;
48
+ action: SponsoredAction;
49
+ actor: string;
50
+ nonce: bigint;
51
+ quoteId: string;
52
+ intentHash: string;
53
+ registrar: string;
54
+ resolver: string;
55
+ relayer: string;
56
+ charge: bigint;
57
+ issuedLedger: number;
58
+ expiresLedger: number;
59
+ };
60
+ export type SponsoredIdentityIntent = {
61
+ name: string;
62
+ actor: string;
63
+ routingId: bigint | null;
64
+ generation: bigint;
65
+ destination: PaymentDestination;
66
+ previous: string | null;
67
+ };
68
+ export type SponsorReceipt = {
69
+ quoteId: string;
70
+ intentHash: string;
71
+ actor: string;
72
+ nonce: bigint;
73
+ action: SponsoredAction;
74
+ charge: bigint;
75
+ relayer: string;
76
+ balance: bigint;
77
+ ledger: number;
78
+ };
79
+ export type SponsorActorState = {
80
+ nonce: bigint;
81
+ claims: bigint;
82
+ utcDay: bigint;
83
+ identityToday: number;
84
+ lastReceipt: SponsorReceipt | null;
85
+ };
86
+ export declare const fundingConfigurationFromNative: (v: unknown) => FundingConfiguration;
87
+ export declare const fundingPositionFromNative: (v: unknown) => FundingPosition;
88
+ export declare const sponsorPolicyFromNative: (v: unknown) => SponsorPolicy;
89
+ export declare const sponsorQuoteFromNative: (v: unknown) => SponsorQuote;
90
+ export declare const sponsoredIdentityFromNative: (v: unknown) => SponsoredIdentityIntent;
91
+ export declare const sponsorReceiptFromNative: (v: unknown) => SponsorReceipt;
92
+ export declare const sponsorActorFromNative: (v: unknown) => SponsorActorState;
93
+ export declare const sponsoredActionToScVal: (v: SponsoredAction) => xdr.ScVal;
94
+ export declare function sponsorPolicyToScVal(v: SponsorPolicy): xdr.ScVal;
95
+ export declare function sponsorQuoteToScVal(v: SponsorQuote): xdr.ScVal;
96
+ export declare const sponsoredIdentityToScVal: (v: SponsoredIdentityIntent) => xdr.ScVal;
97
+ export declare function sponsorIntentHash(action: SponsoredAction, intent: ClaimIntent | SponsoredIdentityIntent): string;
98
+ export declare function fundingPositionId(namespace: string, ownerEpoch: bigint): string;
99
+ /** Canonical XDR is used for transport; JSON bigint coercion is never accepted. */
100
+ export declare const encodeSponsorQuote: (v: SponsorQuote) => string;
101
+ export declare function decodeSponsorQuote(encoded: string): SponsorQuote;
102
+ export declare const FUNDING_ERRORS: Record<number, string>;
@@ -0,0 +1,249 @@
1
+ import { hash, nativeToScVal, scValToNative, xdr } from "@stellar/stellar-sdk";
2
+ import { address, amount, bool, bytes32, exactObject, hex, hex32, label, paymentDestinationToScVal, sc, struct, u32, u64, unhex, } from "./native-codec.js";
3
+ import { destinationFromNative } from "./payment.js";
4
+ import { claimIntentToScVal } from "./native-types.js";
5
+ export class FundingError extends Error {
6
+ kind;
7
+ transactionHash;
8
+ constructor(message, kind = "invalid", transactionHash = null) {
9
+ super(message);
10
+ this.kind = kind;
11
+ this.transactionHash = transactionHash;
12
+ this.name = "FundingError";
13
+ }
14
+ }
15
+ const primitive = (validate, encode) => ({ encode: (v) => encode(validate(v)), decode: validate });
16
+ const U64 = primitive((v) => u64(v, "funding u64"), sc.u64), U32 = primitive((v) => u32(v, "funding u32"), sc.u32);
17
+ const MONEY = primitive((v) => amount(v, "funding amount"), sc.i128), BOOL = primitive((v) => bool(v, "funding boolean"), sc.bool);
18
+ const G = primitive((v) => address(v, "account", "funding account"), sc.address), C = primitive((v) => address(v, "contract", "funding contract"), sc.address), ID = primitive((v) => address(v, "identity", "funding controller"), sc.address);
19
+ const HEX = {
20
+ encode: (v) => sc.bytes(unhex(hex32(v, "funding hash"))),
21
+ decode: (v) => hex(bytes32(v, "funding hash")),
22
+ };
23
+ function fullName(v) {
24
+ if (typeof v !== "string")
25
+ throw new FundingError("name must be a string");
26
+ const parts = v.split(".");
27
+ if (parts.length !== 2)
28
+ throw new FundingError("name must include its namespace");
29
+ parts.forEach(label);
30
+ return v;
31
+ }
32
+ const NAME = primitive(fullName, (v) => nativeToScVal(v, { type: "string" }));
33
+ const optional = (c) => ({
34
+ encode: (v) => (v === null ? xdr.ScVal.scvVoid() : c.encode(v)),
35
+ decode: (v) => (v === null || v === undefined ? null : c.decode(v)),
36
+ });
37
+ const enumeration = (tags) => ({
38
+ encode: (v) => {
39
+ if (typeof v !== "string" || !Object.hasOwn(tags, v))
40
+ throw new FundingError("unknown funding enum");
41
+ return xdr.ScVal.scvVec([sc.symbol(tags[v])]);
42
+ },
43
+ decode: (v) => {
44
+ if (!Array.isArray(v) || v.length !== 1)
45
+ throw new FundingError("malformed funding enum");
46
+ const pair = Object.entries(tags).find(([, tag]) => tag === v[0]);
47
+ if (!pair)
48
+ throw new FundingError("unknown funding enum");
49
+ return pair[0];
50
+ },
51
+ });
52
+ const ACTION = enumeration({
53
+ claim: "Claim",
54
+ reverse: "Reverse",
55
+ primary: "Primary",
56
+ });
57
+ const snake = (v) => v.replace(/[A-Z]/g, (c) => "_" + c.toLowerCase());
58
+ function model(fields) {
59
+ return {
60
+ encode: (v) => {
61
+ const r = exactObject(v, Object.keys(fields), "funding input");
62
+ return struct(Object.fromEntries(Object.entries(fields).map(([k, c]) => [snake(k), c.encode(r[k])])));
63
+ },
64
+ decode: (v) => {
65
+ const r = exactObject(v, Object.keys(fields).map(snake), "funding result");
66
+ return Object.fromEntries(Object.entries(fields).map(([k, c]) => [k, c.decode(r[snake(k)])]));
67
+ },
68
+ };
69
+ }
70
+ const CONFIG = model({
71
+ registry: C,
72
+ nativeAsset: C,
73
+ lookup: C,
74
+ primary: C,
75
+ governance: ID,
76
+ paused: BOOL,
77
+ revision: U64,
78
+ });
79
+ const POSITION = model({
80
+ namespace: HEX,
81
+ ownerEpoch: U64,
82
+ controller: ID,
83
+ balance: MONEY,
84
+ spentTotal: MONEY,
85
+ utcDay: U64,
86
+ spentToday: MONEY,
87
+ policyRevision: U64,
88
+ status: enumeration({ paused: "Paused", active: "Active", closed: "Closed" }),
89
+ });
90
+ const POLICY = model({
91
+ claimCap: MONEY,
92
+ reverseCap: MONEY,
93
+ primaryCap: MONEY,
94
+ dailyCap: MONEY,
95
+ totalCap: MONEY,
96
+ claimsPerWallet: U64,
97
+ identityPerDay: U32,
98
+ relayer: G,
99
+ quoteLifetime: U32,
100
+ validUntil: U64,
101
+ });
102
+ const QUOTE = model({
103
+ network: HEX,
104
+ funding: C,
105
+ configRevision: U64,
106
+ fundId: HEX,
107
+ policyRevision: U64,
108
+ action: ACTION,
109
+ actor: ID,
110
+ nonce: U64,
111
+ quoteId: HEX,
112
+ intentHash: HEX,
113
+ registrar: C,
114
+ resolver: C,
115
+ relayer: G,
116
+ charge: MONEY,
117
+ issuedLedger: U32,
118
+ expiresLedger: U32,
119
+ });
120
+ const DEST = {
121
+ encode: (v) => paymentDestinationToScVal(v),
122
+ decode: destinationFromNative,
123
+ };
124
+ const IDENTITY = model({
125
+ name: NAME,
126
+ actor: ID,
127
+ routingId: optional(U64),
128
+ generation: U64,
129
+ destination: DEST,
130
+ previous: optional(NAME),
131
+ });
132
+ const RECEIPT = model({
133
+ quoteId: HEX,
134
+ intentHash: HEX,
135
+ actor: ID,
136
+ nonce: U64,
137
+ action: ACTION,
138
+ charge: MONEY,
139
+ relayer: G,
140
+ balance: MONEY,
141
+ ledger: U32,
142
+ });
143
+ const LAST_RECEIPT = {
144
+ encode: (v) => xdr.ScVal.scvVec(v === null
145
+ ? [sc.symbol("Empty")]
146
+ : [sc.symbol("Recorded"), RECEIPT.encode(v)]),
147
+ decode: (v) => {
148
+ if (Array.isArray(v) && v.length === 1 && v[0] === "Empty")
149
+ return null;
150
+ if (Array.isArray(v) && v.length === 2 && v[0] === "Recorded")
151
+ return RECEIPT.decode(v[1]);
152
+ throw new FundingError("malformed receipt state");
153
+ },
154
+ };
155
+ const ACTOR = model({
156
+ nonce: U64,
157
+ claims: U64,
158
+ utcDay: U64,
159
+ identityToday: U32,
160
+ lastReceipt: LAST_RECEIPT,
161
+ });
162
+ export const fundingConfigurationFromNative = (v) => CONFIG.decode(v);
163
+ export const fundingPositionFromNative = (v) => POSITION.decode(v);
164
+ export const sponsorPolicyFromNative = (v) => POLICY.decode(v);
165
+ export const sponsorQuoteFromNative = (v) => QUOTE.decode(v);
166
+ export const sponsoredIdentityFromNative = (v) => IDENTITY.decode(v);
167
+ export const sponsorReceiptFromNative = (v) => RECEIPT.decode(v);
168
+ export const sponsorActorFromNative = (v) => ACTOR.decode(v);
169
+ export const sponsoredActionToScVal = (v) => ACTION.encode(v);
170
+ export function sponsorPolicyToScVal(v) {
171
+ const value = POLICY.encode(v);
172
+ if (v.dailyCap === 0n ||
173
+ v.totalCap === 0n ||
174
+ v.dailyCap > v.totalCap ||
175
+ [v.claimCap, v.reverseCap, v.primaryCap].some((n) => n > v.dailyCap) ||
176
+ [v.claimCap, v.reverseCap, v.primaryCap].every((n) => n === 0n) ||
177
+ (v.claimCap > 0n && v.claimsPerWallet === 0n) ||
178
+ ((v.reverseCap > 0n || v.primaryCap > 0n) && v.identityPerDay === 0) ||
179
+ v.quoteLifetime < 1 ||
180
+ v.quoteLifetime > 120 ||
181
+ v.validUntil === 0n)
182
+ throw new FundingError("invalid coverage, spending limits or policy lifetime");
183
+ return value;
184
+ }
185
+ export function sponsorQuoteToScVal(v) {
186
+ const result = QUOTE.encode(v);
187
+ if (v.charge === 0n ||
188
+ v.actor === v.relayer ||
189
+ v.expiresLedger <= v.issuedLedger ||
190
+ v.expiresLedger - v.issuedLedger > 120)
191
+ throw new FundingError("invalid sponsor charge, actor or quote lifetime");
192
+ return result;
193
+ }
194
+ export const sponsoredIdentityToScVal = (v) => IDENTITY.encode(v);
195
+ export function sponsorIntentHash(action, intent) {
196
+ const encoded = action === "claim"
197
+ ? claimIntentToScVal(intent)
198
+ : sponsoredIdentityToScVal(intent);
199
+ return hex(hash(xdr.ScVal.scvVec([sc.symbol("sponsor_" + action), encoded]).toXDR()));
200
+ }
201
+ export function fundingPositionId(namespace, ownerEpoch) {
202
+ return hex(hash(xdr.ScVal.scvVec([
203
+ sc.symbol("fund_v1"),
204
+ HEX.encode(namespace),
205
+ U64.encode(ownerEpoch),
206
+ ]).toXDR()));
207
+ }
208
+ /** Canonical XDR is used for transport; JSON bigint coercion is never accepted. */
209
+ export const encodeSponsorQuote = (v) => sponsorQuoteToScVal(v).toXDR("base64");
210
+ export function decodeSponsorQuote(encoded) {
211
+ if (typeof encoded !== "string" || encoded.length > 16_384)
212
+ throw new FundingError("invalid sponsor quote size");
213
+ const q = sponsorQuoteFromNative(scValToNative(xdr.ScVal.fromXDR(encoded, "base64")));
214
+ sponsorQuoteToScVal(q);
215
+ return q;
216
+ }
217
+ export const FUNDING_ERRORS = {
218
+ 1: "Not initialized",
219
+ 2: "Unsupported network",
220
+ 3: "Invalid configuration",
221
+ 4: "Funding position not found",
222
+ 5: "Funding position already exists",
223
+ 6: "Funding position closed",
224
+ 7: "Namespace ownership changed",
225
+ 8: "Contract state unavailable",
226
+ 9: "Invalid amount",
227
+ 10: "Insufficient sponsorship funds",
228
+ 11: "Invalid spending policy",
229
+ 12: "Spending policy not configured",
230
+ 13: "Sponsorship paused",
231
+ 14: "Quote is stale",
232
+ 15: "Quote expired",
233
+ 16: "Invalid quote",
234
+ 17: "Spending limit reached",
235
+ 18: "Wallet allowance reached",
236
+ 19: "Request already used",
237
+ 20: "Action is not sponsored",
238
+ 21: "Namespace contract changed",
239
+ 22: "Action differs from approval",
240
+ 23: "Action already completed",
241
+ 24: "Name operation failed",
242
+ 25: "Sponsor payment failed",
243
+ 26: "Amount or counter overflow",
244
+ 27: "Re-entry refused",
245
+ 28: "Invalid name",
246
+ 29: "Name inactive",
247
+ 30: "Name state changed",
248
+ 31: "Upgrade does not match",
249
+ };
@@ -0,0 +1,40 @@
1
+ import { Transaction, authorizeEntry, xdr } from "@stellar/stellar-sdk";
2
+ import { FundingReader } from "./funding-reader.js";
3
+ import { type ContractWallet } from "./contract-wallet.js";
4
+ import { type SponsorQuote, type SponsoredIdentityIntent } from "./funding-types.js";
5
+ import { type ClaimIntent } from "./native-types.js";
6
+ import { type NativeInvocation } from "./native-auth.js";
7
+ export type SponsorRequest = {
8
+ quote: SponsorQuote;
9
+ intent: ClaimIntent | SponsoredIdentityIntent;
10
+ proof?: readonly string[];
11
+ };
12
+ export type SponsorPlan = {
13
+ request: SponsorRequest;
14
+ method: string;
15
+ args: xdr.ScVal[];
16
+ actorInvocation: NativeInvocation;
17
+ relayerInvocation: NativeInvocation;
18
+ eligibility?: {
19
+ account: string;
20
+ invocation: NativeInvocation;
21
+ latestLedger: number;
22
+ maxExpirationLedger: number;
23
+ };
24
+ maxNetworkFee: bigint;
25
+ };
26
+ /** Build from the app's reviewed intent and pinned shared contracts, never a remote invocation tree. */
27
+ export declare function sponsorPlan(request: SponsorRequest, lookup: string, primary: string, maxNetworkFee: bigint, eligibilityAccount?: string): SponsorPlan;
28
+ export declare function validateSponsorTransaction(tx: Transaction, p: SponsorPlan, latestLedger: number, signed?: boolean): xdr.SorobanAuthorizationEntry;
29
+ export declare function replaceSponsorAuth(tx: Transaction, auth: xdr.SorobanAuthorizationEntry[], passphrase: string): Transaction;
30
+ export declare class SoranSponsorship extends FundingReader {
31
+ plan(request: SponsorRequest, maxNetworkFee: bigint): Promise<SponsorPlan>;
32
+ prepare(request: SponsorRequest, maxNetworkFee: bigint, inclusionFee?: bigint): Promise<{
33
+ transaction: Transaction;
34
+ plan: SponsorPlan;
35
+ ledger: number;
36
+ }>;
37
+ /** Sign only the caller's authorization. C wallets supply their own signature
38
+ * format; the service enforces __check_auth before the relayer signs. */
39
+ authorize(request: SponsorRequest, encoded: string, signer: Parameters<typeof authorizeEntry>[1] | ContractWallet, maxSponsorCharge: bigint, maxNetworkFee: bigint, eligibilityXdr?: string): Promise<string>;
40
+ }