@vallum/sdk 0.0.0-prerelease

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,110 @@
1
+ import { approvePayPerCallReceipt, completePayPerCallReceipt, createPayPerCallReceipt, denyPayPerCallReceipt, failPayPerCallReceipt, sponsorPayPerCallReceipt, submitPayPerCallReceipt, } from "@vallum/receipts";
2
+ import { requestSponsoredAction } from "../requestSponsoredAction.js";
3
+ export async function callPaidTool(options) {
4
+ const now = options.now?.() ?? new Date();
5
+ const attempted = createPayPerCallReceipt({
6
+ receiptId: options.receiptId,
7
+ manifestId: options.manifest.idempotencyKey,
8
+ idempotencyKey: options.manifest.idempotencyKey,
9
+ agentId: options.manifest.agent.id,
10
+ ownerId: options.manifest.owner.id,
11
+ providerId: options.providerId,
12
+ toolName: options.toolName,
13
+ amount: options.amount,
14
+ createdAt: now,
15
+ });
16
+ const sponsoredAction = await requestSponsoredAction({
17
+ baseUrl: options.gatewayBaseUrl,
18
+ apiKey: options.apiKey,
19
+ fetchImpl: options.fetchImpl,
20
+ manifest: options.manifest,
21
+ });
22
+ if (!sponsoredAction.approved) {
23
+ return {
24
+ paid: false,
25
+ sponsoredAction,
26
+ receipt: denyPayPerCallReceipt(attempted, {
27
+ at: now,
28
+ reason: sponsoredAction.decision.reasonCode,
29
+ }),
30
+ };
31
+ }
32
+ const sponsored = sponsorPayPerCallReceipt(approvePayPerCallReceipt(attempted, { at: now }), {
33
+ at: now,
34
+ sponsorshipId: sponsoredAction.mockSponsorshipId,
35
+ });
36
+ const payment = await confirmPayment(options.confirmPayment);
37
+ if (!payment.ok) {
38
+ return {
39
+ paid: false,
40
+ sponsoredAction,
41
+ receipt: failPayPerCallReceipt(sponsored, {
42
+ at: now,
43
+ reason: payment.reason,
44
+ }),
45
+ };
46
+ }
47
+ if (!isNonEmptyString(payment.transactionDigest)) {
48
+ return {
49
+ paid: false,
50
+ sponsoredAction,
51
+ receipt: failPayPerCallReceipt(sponsored, {
52
+ at: now,
53
+ reason: "PAYMENT_CONFIRMATION_INVALID",
54
+ }),
55
+ };
56
+ }
57
+ const submitted = submitPayPerCallReceipt(sponsored, {
58
+ at: now,
59
+ transactionDigest: payment.transactionDigest,
60
+ });
61
+ const invocation = await invokeTool(options.invokeTool);
62
+ if (!invocation.ok) {
63
+ return {
64
+ paid: false,
65
+ sponsoredAction,
66
+ receipt: failPayPerCallReceipt(submitted, {
67
+ at: now,
68
+ reason: invocation.reason,
69
+ }),
70
+ };
71
+ }
72
+ if (!isNonEmptyString(invocation.result.resultHash)) {
73
+ return {
74
+ paid: false,
75
+ sponsoredAction,
76
+ receipt: failPayPerCallReceipt(submitted, {
77
+ at: now,
78
+ reason: "TOOL_RESULT_HASH_INVALID",
79
+ }),
80
+ };
81
+ }
82
+ return {
83
+ paid: true,
84
+ sponsoredAction,
85
+ result: invocation.result.result,
86
+ receipt: completePayPerCallReceipt(submitted, {
87
+ at: now,
88
+ resultHash: invocation.result.resultHash,
89
+ }),
90
+ };
91
+ }
92
+ async function confirmPayment(confirmPaymentFn) {
93
+ try {
94
+ return await confirmPaymentFn();
95
+ }
96
+ catch {
97
+ return { ok: false, reason: "PAYMENT_CONFIRMATION_FAILED" };
98
+ }
99
+ }
100
+ async function invokeTool(invokeToolFn) {
101
+ try {
102
+ return { ok: true, result: await invokeToolFn() };
103
+ }
104
+ catch {
105
+ return { ok: false, reason: "TOOL_INVOCATION_FAILED" };
106
+ }
107
+ }
108
+ function isNonEmptyString(value) {
109
+ return typeof value === "string" && value.trim() !== "";
110
+ }
@@ -0,0 +1,39 @@
1
+ import type { AgentTransactionManifest } from "@vallum/manifest";
2
+ import { type ReceiptAmount, type ReputationReceipt } from "@vallum/receipts";
3
+ import type { SponsoredActionResult } from "../types.js";
4
+ export type ReputationEvidence = {
5
+ readonly ok: true;
6
+ readonly transactionDigest: string;
7
+ readonly score: number;
8
+ readonly evidenceHash: string;
9
+ readonly attestationHash: string;
10
+ } | {
11
+ readonly ok: false;
12
+ readonly reason: string;
13
+ };
14
+ export interface AttestReputationOptions {
15
+ readonly gatewayBaseUrl: string;
16
+ readonly apiKey: string;
17
+ readonly manifest: AgentTransactionManifest;
18
+ readonly receiptId: string;
19
+ readonly issuerId: string;
20
+ readonly subjectId: string;
21
+ readonly interactionId: string;
22
+ readonly criteriaHash: string;
23
+ readonly amount: ReceiptAmount;
24
+ readonly collectEvidence: () => Promise<ReputationEvidence>;
25
+ readonly now?: () => Date;
26
+ readonly fetchImpl?: typeof fetch;
27
+ }
28
+ export type AttestReputationResult = {
29
+ readonly attested: true;
30
+ readonly sponsoredAction: Extract<SponsoredActionResult, {
31
+ approved: true;
32
+ }>;
33
+ readonly receipt: ReputationReceipt;
34
+ } | {
35
+ readonly attested: false;
36
+ readonly sponsoredAction: SponsoredActionResult;
37
+ readonly receipt: ReputationReceipt;
38
+ };
39
+ export declare function attestReputation(options: AttestReputationOptions): Promise<AttestReputationResult>;
@@ -0,0 +1,94 @@
1
+ import { approveReputationReceipt, completeReputationReceipt, createReputationReceipt, denyReputationReceipt, failReputationReceipt, sponsorReputationReceipt, submitReputationReceipt, } from "@vallum/receipts";
2
+ import { requestSponsoredAction } from "../requestSponsoredAction.js";
3
+ export async function attestReputation(options) {
4
+ const now = options.now?.() ?? new Date();
5
+ const attempted = createReputationReceipt({
6
+ receiptId: options.receiptId,
7
+ manifestId: options.manifest.idempotencyKey,
8
+ idempotencyKey: options.manifest.idempotencyKey,
9
+ agentId: options.manifest.agent.id,
10
+ ownerId: options.manifest.owner.id,
11
+ issuerId: options.issuerId,
12
+ subjectId: options.subjectId,
13
+ interactionId: options.interactionId,
14
+ criteriaHash: options.criteriaHash,
15
+ amount: options.amount,
16
+ createdAt: now,
17
+ });
18
+ const sponsoredAction = await requestSponsoredAction({
19
+ baseUrl: options.gatewayBaseUrl,
20
+ apiKey: options.apiKey,
21
+ fetchImpl: options.fetchImpl,
22
+ manifest: options.manifest,
23
+ });
24
+ if (!sponsoredAction.approved) {
25
+ return {
26
+ attested: false,
27
+ sponsoredAction,
28
+ receipt: denyReputationReceipt(attempted, {
29
+ at: now,
30
+ reason: sponsoredAction.decision.reasonCode,
31
+ }),
32
+ };
33
+ }
34
+ const sponsored = sponsorReputationReceipt(approveReputationReceipt(attempted, { at: now }), {
35
+ at: now,
36
+ sponsorshipId: sponsoredAction.mockSponsorshipId,
37
+ });
38
+ const evidence = await collectEvidence(options.collectEvidence);
39
+ if (!evidence.ok) {
40
+ return {
41
+ attested: false,
42
+ sponsoredAction,
43
+ receipt: failReputationReceipt(sponsored, {
44
+ at: now,
45
+ reason: evidence.reason,
46
+ }),
47
+ };
48
+ }
49
+ if (!Number.isInteger(evidence.score)
50
+ || evidence.score < 1
51
+ || evidence.score > 5
52
+ || !isNonEmptyString(evidence.transactionDigest)
53
+ || !isSafeHashReference(evidence.evidenceHash)
54
+ || !isSafeHashReference(evidence.attestationHash)) {
55
+ return {
56
+ attested: false,
57
+ sponsoredAction,
58
+ receipt: failReputationReceipt(sponsored, {
59
+ at: now,
60
+ reason: "REPUTATION_EVIDENCE_INVALID",
61
+ }),
62
+ };
63
+ }
64
+ const submitted = submitReputationReceipt(sponsored, {
65
+ at: now,
66
+ transactionDigest: evidence.transactionDigest,
67
+ });
68
+ return {
69
+ attested: true,
70
+ sponsoredAction,
71
+ receipt: completeReputationReceipt(submitted, {
72
+ at: now,
73
+ score: evidence.score,
74
+ evidenceHash: evidence.evidenceHash,
75
+ attestationHash: evidence.attestationHash,
76
+ }),
77
+ };
78
+ }
79
+ async function collectEvidence(collectEvidenceFn) {
80
+ try {
81
+ return await collectEvidenceFn();
82
+ }
83
+ catch {
84
+ return { ok: false, reason: "REPUTATION_EVIDENCE_FAILED" };
85
+ }
86
+ }
87
+ function isNonEmptyString(value) {
88
+ return typeof value === "string" && value.trim() !== "";
89
+ }
90
+ function isSafeHashReference(value) {
91
+ return isNonEmptyString(value)
92
+ && /^sha256:[A-Za-z0-9._:-]+$/.test(value)
93
+ && !/(private prompt|review payload|bearer|signer_ref|payment credential|privateKey|mnemonic|seed)/i.test(value);
94
+ }
@@ -0,0 +1,38 @@
1
+ import type { AgentTransactionManifest } from "@vallum/manifest";
2
+ import { type ReceiptAmount, type ServiceBountyReceipt } from "@vallum/receipts";
3
+ import type { SponsoredActionResult } from "../types.js";
4
+ export type ServiceBountyCompletionProof = {
5
+ readonly ok: true;
6
+ readonly transactionDigest: string;
7
+ readonly completionProofHash: string;
8
+ readonly releaseProofHash: string;
9
+ } | {
10
+ readonly ok: false;
11
+ readonly reason: string;
12
+ };
13
+ export interface FulfillServiceBountyOptions {
14
+ readonly gatewayBaseUrl: string;
15
+ readonly apiKey: string;
16
+ readonly manifest: AgentTransactionManifest;
17
+ readonly receiptId: string;
18
+ readonly requesterId: string;
19
+ readonly providerId: string;
20
+ readonly bountyId: string;
21
+ readonly deliverableHash: string;
22
+ readonly amount: ReceiptAmount;
23
+ readonly completeWork: () => Promise<ServiceBountyCompletionProof>;
24
+ readonly now?: () => Date;
25
+ readonly fetchImpl?: typeof fetch;
26
+ }
27
+ export type FulfillServiceBountyResult = {
28
+ readonly released: true;
29
+ readonly sponsoredAction: Extract<SponsoredActionResult, {
30
+ approved: true;
31
+ }>;
32
+ readonly receipt: ServiceBountyReceipt;
33
+ } | {
34
+ readonly released: false;
35
+ readonly sponsoredAction: SponsoredActionResult;
36
+ readonly receipt: ServiceBountyReceipt;
37
+ };
38
+ export declare function fulfillServiceBounty(options: FulfillServiceBountyOptions): Promise<FulfillServiceBountyResult>;
@@ -0,0 +1,88 @@
1
+ import { approveServiceBountyReceipt, completeServiceBountyReceipt, createServiceBountyReceipt, denyServiceBountyReceipt, failServiceBountyReceipt, releaseServiceBountyReceipt, sponsorServiceBountyReceipt, submitServiceBountyReceipt, } from "@vallum/receipts";
2
+ import { requestSponsoredAction } from "../requestSponsoredAction.js";
3
+ export async function fulfillServiceBounty(options) {
4
+ const now = options.now?.() ?? new Date();
5
+ const attempted = createServiceBountyReceipt({
6
+ receiptId: options.receiptId,
7
+ manifestId: options.manifest.idempotencyKey,
8
+ idempotencyKey: options.manifest.idempotencyKey,
9
+ agentId: options.manifest.agent.id,
10
+ ownerId: options.manifest.owner.id,
11
+ requesterId: options.requesterId,
12
+ providerId: options.providerId,
13
+ bountyId: options.bountyId,
14
+ deliverableHash: options.deliverableHash,
15
+ amount: options.amount,
16
+ createdAt: now,
17
+ });
18
+ const sponsoredAction = await requestSponsoredAction({
19
+ baseUrl: options.gatewayBaseUrl,
20
+ apiKey: options.apiKey,
21
+ fetchImpl: options.fetchImpl,
22
+ manifest: options.manifest,
23
+ });
24
+ if (!sponsoredAction.approved) {
25
+ return {
26
+ released: false,
27
+ sponsoredAction,
28
+ receipt: denyServiceBountyReceipt(attempted, {
29
+ at: now,
30
+ reason: sponsoredAction.decision.reasonCode,
31
+ }),
32
+ };
33
+ }
34
+ const sponsored = sponsorServiceBountyReceipt(approveServiceBountyReceipt(attempted, { at: now }), {
35
+ at: now,
36
+ sponsorshipId: sponsoredAction.mockSponsorshipId,
37
+ });
38
+ const proof = await completeWork(options.completeWork);
39
+ if (!proof.ok) {
40
+ return {
41
+ released: false,
42
+ sponsoredAction,
43
+ receipt: failServiceBountyReceipt(sponsored, {
44
+ at: now,
45
+ reason: proof.reason,
46
+ }),
47
+ };
48
+ }
49
+ if (!isNonEmptyString(proof.transactionDigest)
50
+ || !isNonEmptyString(proof.completionProofHash)
51
+ || !isNonEmptyString(proof.releaseProofHash)) {
52
+ return {
53
+ released: false,
54
+ sponsoredAction,
55
+ receipt: failServiceBountyReceipt(sponsored, {
56
+ at: now,
57
+ reason: "COMPLETION_PROOF_INVALID",
58
+ }),
59
+ };
60
+ }
61
+ const submitted = submitServiceBountyReceipt(sponsored, {
62
+ at: now,
63
+ transactionDigest: proof.transactionDigest,
64
+ });
65
+ const completed = completeServiceBountyReceipt(submitted, {
66
+ at: now,
67
+ completionProofHash: proof.completionProofHash,
68
+ });
69
+ return {
70
+ released: true,
71
+ sponsoredAction,
72
+ receipt: releaseServiceBountyReceipt(completed, {
73
+ at: now,
74
+ releaseProofHash: proof.releaseProofHash,
75
+ }),
76
+ };
77
+ }
78
+ async function completeWork(completeWorkFn) {
79
+ try {
80
+ return await completeWorkFn();
81
+ }
82
+ catch {
83
+ return { ok: false, reason: "COMPLETION_PROOF_FAILED" };
84
+ }
85
+ }
86
+ function isNonEmptyString(value) {
87
+ return typeof value === "string" && value.trim() !== "";
88
+ }
@@ -0,0 +1,69 @@
1
+ import type { AgentTransactionManifest } from "@vallum/manifest";
2
+ import { type ReceiptAmount, type SubscriptionReceipt } from "@vallum/receipts";
3
+ import type { SponsoredActionResult } from "../types.js";
4
+ export type SubscriptionActivationProof = {
5
+ readonly ok: true;
6
+ readonly transactionDigest: string;
7
+ readonly activationProofHash: string;
8
+ } | {
9
+ readonly ok: false;
10
+ readonly reason: string;
11
+ };
12
+ export type SubscriptionRenewalProof = {
13
+ readonly ok: true;
14
+ readonly transactionDigest: string;
15
+ readonly renewalProofHash: string;
16
+ } | {
17
+ readonly ok: false;
18
+ readonly reason: string;
19
+ };
20
+ export interface StartSubscriptionOptions {
21
+ readonly gatewayBaseUrl: string;
22
+ readonly apiKey: string;
23
+ readonly manifest: AgentTransactionManifest;
24
+ readonly receiptId: string;
25
+ readonly subscriberId: string;
26
+ readonly providerId: string;
27
+ readonly planId: string;
28
+ readonly termsHash: string;
29
+ readonly periodStart: string;
30
+ readonly periodEnd: string;
31
+ readonly amount: ReceiptAmount;
32
+ readonly activate: () => Promise<SubscriptionActivationProof>;
33
+ readonly now?: () => Date;
34
+ readonly fetchImpl?: typeof fetch;
35
+ }
36
+ export interface RenewSubscriptionOptions {
37
+ readonly gatewayBaseUrl: string;
38
+ readonly apiKey: string;
39
+ readonly manifest: AgentTransactionManifest;
40
+ readonly receipt: SubscriptionReceipt;
41
+ readonly periodEnd: string;
42
+ readonly renew: () => Promise<SubscriptionRenewalProof>;
43
+ readonly now?: () => Date;
44
+ readonly fetchImpl?: typeof fetch;
45
+ }
46
+ export type StartSubscriptionResult = {
47
+ readonly active: true;
48
+ readonly sponsoredAction: Extract<SponsoredActionResult, {
49
+ approved: true;
50
+ }>;
51
+ readonly receipt: SubscriptionReceipt;
52
+ } | {
53
+ readonly active: false;
54
+ readonly sponsoredAction: SponsoredActionResult;
55
+ readonly receipt: SubscriptionReceipt;
56
+ };
57
+ export type RenewSubscriptionResult = {
58
+ readonly renewed: true;
59
+ readonly sponsoredAction: Extract<SponsoredActionResult, {
60
+ approved: true;
61
+ }>;
62
+ readonly receipt: SubscriptionReceipt;
63
+ } | {
64
+ readonly renewed: false;
65
+ readonly sponsoredAction: SponsoredActionResult;
66
+ readonly receipt: SubscriptionReceipt;
67
+ };
68
+ export declare function startSubscription(options: StartSubscriptionOptions): Promise<StartSubscriptionResult>;
69
+ export declare function renewSubscription(options: RenewSubscriptionOptions): Promise<RenewSubscriptionResult>;
@@ -0,0 +1,148 @@
1
+ import { activateSubscriptionReceipt, approveSubscriptionReceipt, createSubscriptionReceipt, denySubscriptionReceipt, failSubscriptionReceipt, renewSubscriptionReceipt as renewSubscriptionReceiptState, sponsorSubscriptionReceipt, submitSubscriptionReceipt, } from "@vallum/receipts";
2
+ import { requestSponsoredAction } from "../requestSponsoredAction.js";
3
+ export async function startSubscription(options) {
4
+ const now = options.now?.() ?? new Date();
5
+ const attempted = createSubscriptionReceipt({
6
+ receiptId: options.receiptId,
7
+ manifestId: options.manifest.idempotencyKey,
8
+ idempotencyKey: options.manifest.idempotencyKey,
9
+ agentId: options.manifest.agent.id,
10
+ ownerId: options.manifest.owner.id,
11
+ subscriberId: options.subscriberId,
12
+ providerId: options.providerId,
13
+ planId: options.planId,
14
+ termsHash: options.termsHash,
15
+ periodStart: options.periodStart,
16
+ periodEnd: options.periodEnd,
17
+ amount: options.amount,
18
+ createdAt: now,
19
+ });
20
+ const sponsoredAction = await requestSponsoredAction({
21
+ baseUrl: options.gatewayBaseUrl,
22
+ apiKey: options.apiKey,
23
+ fetchImpl: options.fetchImpl,
24
+ manifest: options.manifest,
25
+ });
26
+ if (!sponsoredAction.approved) {
27
+ return {
28
+ active: false,
29
+ sponsoredAction,
30
+ receipt: denySubscriptionReceipt(attempted, {
31
+ at: now,
32
+ reason: sponsoredAction.decision.reasonCode,
33
+ }),
34
+ };
35
+ }
36
+ const sponsored = sponsorSubscriptionReceipt(approveSubscriptionReceipt(attempted, { at: now }), {
37
+ at: now,
38
+ sponsorshipId: sponsoredAction.mockSponsorshipId,
39
+ });
40
+ const proof = await collectActivationProof(options.activate);
41
+ if (!proof.ok) {
42
+ return {
43
+ active: false,
44
+ sponsoredAction,
45
+ receipt: failSubscriptionReceipt(sponsored, {
46
+ at: now,
47
+ reason: proof.reason,
48
+ }),
49
+ };
50
+ }
51
+ if (!isNonEmptyString(proof.transactionDigest) || !isSafeHashReference(proof.activationProofHash)) {
52
+ return {
53
+ active: false,
54
+ sponsoredAction,
55
+ receipt: failSubscriptionReceipt(sponsored, {
56
+ at: now,
57
+ reason: "SUBSCRIPTION_PROOF_INVALID",
58
+ }),
59
+ };
60
+ }
61
+ const submitted = submitSubscriptionReceipt(sponsored, {
62
+ at: now,
63
+ transactionDigest: proof.transactionDigest,
64
+ });
65
+ return {
66
+ active: true,
67
+ sponsoredAction,
68
+ receipt: activateSubscriptionReceipt(submitted, {
69
+ at: now,
70
+ activationProofHash: proof.activationProofHash,
71
+ }),
72
+ };
73
+ }
74
+ export async function renewSubscription(options) {
75
+ const now = options.now?.() ?? new Date();
76
+ const sponsoredAction = await requestSponsoredAction({
77
+ baseUrl: options.gatewayBaseUrl,
78
+ apiKey: options.apiKey,
79
+ fetchImpl: options.fetchImpl,
80
+ manifest: options.manifest,
81
+ });
82
+ if (!sponsoredAction.approved) {
83
+ return {
84
+ renewed: false,
85
+ sponsoredAction,
86
+ receipt: failSubscriptionReceipt(options.receipt, {
87
+ at: now,
88
+ reason: sponsoredAction.decision.reasonCode,
89
+ }),
90
+ };
91
+ }
92
+ const proof = await collectRenewalProof(options.renew);
93
+ if (!proof.ok) {
94
+ return {
95
+ renewed: false,
96
+ sponsoredAction,
97
+ receipt: failSubscriptionReceipt(options.receipt, {
98
+ at: now,
99
+ reason: proof.reason,
100
+ }),
101
+ };
102
+ }
103
+ if (!isNonEmptyString(proof.transactionDigest) || !isSafeHashReference(proof.renewalProofHash)) {
104
+ return {
105
+ renewed: false,
106
+ sponsoredAction,
107
+ receipt: failSubscriptionReceipt(options.receipt, {
108
+ at: now,
109
+ reason: "SUBSCRIPTION_PROOF_INVALID",
110
+ }),
111
+ };
112
+ }
113
+ return {
114
+ renewed: true,
115
+ sponsoredAction,
116
+ receipt: renewSubscriptionReceiptState(options.receipt, {
117
+ at: now,
118
+ periodEnd: options.periodEnd,
119
+ renewalProofHash: proof.renewalProofHash,
120
+ sponsorshipId: sponsoredAction.mockSponsorshipId,
121
+ transactionDigest: proof.transactionDigest,
122
+ }),
123
+ };
124
+ }
125
+ async function collectActivationProof(activate) {
126
+ try {
127
+ return await activate();
128
+ }
129
+ catch {
130
+ return { ok: false, reason: "SUBSCRIPTION_PROOF_FAILED" };
131
+ }
132
+ }
133
+ async function collectRenewalProof(renew) {
134
+ try {
135
+ return await renew();
136
+ }
137
+ catch {
138
+ return { ok: false, reason: "SUBSCRIPTION_PROOF_FAILED" };
139
+ }
140
+ }
141
+ function isNonEmptyString(value) {
142
+ return typeof value === "string" && value.trim() !== "";
143
+ }
144
+ function isSafeHashReference(value) {
145
+ return isNonEmptyString(value)
146
+ && /^sha256:[A-Za-z0-9._:-]+$/.test(value)
147
+ && !/(private prompt|review payload|bearer|access-token|signer_ref|payment credential|privateKey|mnemonic|seed)/i.test(value);
148
+ }
@@ -0,0 +1,12 @@
1
+ export declare class VallumError extends Error {
2
+ readonly status?: number | undefined;
3
+ readonly body?: unknown | undefined;
4
+ constructor(message: string, status?: number | undefined, body?: unknown | undefined);
5
+ }
6
+ export declare class VallumPolicyError extends VallumError {
7
+ readonly reasonCode?: string | undefined;
8
+ constructor(message: string, reasonCode?: string | undefined, status?: number, body?: unknown);
9
+ }
10
+ export declare class VallumAuthError extends VallumError {
11
+ constructor(message: string, status?: number, body?: unknown);
12
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,24 @@
1
+ export class VallumError extends Error {
2
+ status;
3
+ body;
4
+ constructor(message, status, body) {
5
+ super(message);
6
+ this.status = status;
7
+ this.body = body;
8
+ this.name = "VallumError";
9
+ }
10
+ }
11
+ export class VallumPolicyError extends VallumError {
12
+ reasonCode;
13
+ constructor(message, reasonCode, status, body) {
14
+ super(message, status, body);
15
+ this.reasonCode = reasonCode;
16
+ this.name = "VallumPolicyError";
17
+ }
18
+ }
19
+ export class VallumAuthError extends VallumError {
20
+ constructor(message, status, body) {
21
+ super(message, status, body);
22
+ this.name = "VallumAuthError";
23
+ }
24
+ }
@@ -0,0 +1,12 @@
1
+ export * from "./IotaAgent.js";
2
+ export * from "./client.js";
3
+ export * from "./contracts/dataLicense.js";
4
+ export * from "./contracts/openEscrow.js";
5
+ export * from "./contracts/payPerCall.js";
6
+ export * from "./contracts/reputationReceipt.js";
7
+ export * from "./contracts/serviceBounty.js";
8
+ export * from "./contracts/subscription.js";
9
+ export * from "./errors.js";
10
+ export * from "./requestSponsoredAction.js";
11
+ export * from "./resolveAgent.js";
12
+ export * from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ export * from "./IotaAgent.js";
2
+ export * from "./client.js";
3
+ export * from "./contracts/dataLicense.js";
4
+ export * from "./contracts/openEscrow.js";
5
+ export * from "./contracts/payPerCall.js";
6
+ export * from "./contracts/reputationReceipt.js";
7
+ export * from "./contracts/serviceBounty.js";
8
+ export * from "./contracts/subscription.js";
9
+ export * from "./errors.js";
10
+ export * from "./requestSponsoredAction.js";
11
+ export * from "./resolveAgent.js";
12
+ export * from "./types.js";
@@ -0,0 +1,2 @@
1
+ import type { RequestSponsoredActionOptions, SponsoredActionResult } from "./types.js";
2
+ export declare function requestSponsoredAction(options: RequestSponsoredActionOptions): Promise<SponsoredActionResult>;