aether-agent-sdk 1.0.4 → 1.0.6
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/README.md +8 -5
- package/dist/src/agents/SettlementAgent.d.ts +5 -0
- package/dist/src/agents/SettlementAgent.d.ts.map +1 -1
- package/dist/src/agents/SettlementAgent.js +61 -0
- package/dist/src/agents/SettlementAgent.js.map +1 -1
- package/dist/src/facilitator/X402FacilitatorServer.d.ts.map +1 -1
- package/dist/src/facilitator/X402FacilitatorServer.js +45 -19
- package/dist/src/facilitator/X402FacilitatorServer.js.map +1 -1
- package/package.json +3 -2
- package/dist/src/agents/AgentRegistry.d.ts +0 -48
- package/dist/src/agents/AgentRegistry.d.ts.map +0 -1
- package/dist/src/agents/AgentRegistry.js +0 -114
- package/dist/src/agents/AgentRegistry.js.map +0 -1
- package/dist/src/agents/AnalyzerAgent.d.ts +0 -18
- package/dist/src/agents/AnalyzerAgent.d.ts.map +0 -1
- package/dist/src/agents/AnalyzerAgent.js +0 -129
- package/dist/src/agents/AnalyzerAgent.js.map +0 -1
- package/dist/src/agents/IntelligentVerifierAgent.d.ts +0 -46
- package/dist/src/agents/IntelligentVerifierAgent.d.ts.map +0 -1
- package/dist/src/agents/IntelligentVerifierAgent.js +0 -262
- package/dist/src/agents/IntelligentVerifierAgent.js.map +0 -1
- package/dist/src/agents/SettlementAgentEnhanced.d.ts +0 -33
- package/dist/src/agents/SettlementAgentEnhanced.d.ts.map +0 -1
- package/dist/src/agents/SettlementAgentEnhanced.js +0 -219
- package/dist/src/agents/SettlementAgentEnhanced.js.map +0 -1
- package/dist/src/agents/VerifierAgent.d.ts +0 -30
- package/dist/src/agents/VerifierAgent.d.ts.map +0 -1
- package/dist/src/agents/VerifierAgent.js +0 -181
- package/dist/src/agents/VerifierAgent.js.map +0 -1
- package/dist/src/modes/HumanInTheLoopMode.d.ts +0 -92
- package/dist/src/modes/HumanInTheLoopMode.d.ts.map +0 -1
- package/dist/src/modes/HumanInTheLoopMode.js +0 -234
- package/dist/src/modes/HumanInTheLoopMode.js.map +0 -1
- package/dist/src/modes/index.d.ts +0 -8
- package/dist/src/modes/index.d.ts.map +0 -1
- package/dist/src/modes/index.js +0 -11
- package/dist/src/modes/index.js.map +0 -1
- package/dist/src/protocols/A2ANegotiation.d.ts +0 -122
- package/dist/src/protocols/A2ANegotiation.d.ts.map +0 -1
- package/dist/src/protocols/A2ANegotiation.js +0 -230
- package/dist/src/protocols/A2ANegotiation.js.map +0 -1
- package/dist/src/services/index.d.ts +0 -8
- package/dist/src/services/index.d.ts.map +0 -1
- package/dist/src/services/index.js +0 -13
- package/dist/src/services/index.js.map +0 -1
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2A Agent Negotiation Protocol
|
|
3
|
-
*
|
|
4
|
-
* This module implements negotiation logic for agents to:
|
|
5
|
-
* - Negotiate payment terms
|
|
6
|
-
* - Handle counter-offers
|
|
7
|
-
* - Manage negotiation timeouts
|
|
8
|
-
* - Track negotiation history
|
|
9
|
-
*
|
|
10
|
-
* Used for the hackathon bounty "Best Use of Hedera Agent Kit & Google A2A"
|
|
11
|
-
*/
|
|
12
|
-
import { A2AProtocol, A2AMessage } from './A2AProtocol';
|
|
13
|
-
/**
|
|
14
|
-
* Negotiation State
|
|
15
|
-
*/
|
|
16
|
-
export declare enum NegotiationState {
|
|
17
|
-
PENDING = "pending",
|
|
18
|
-
IN_PROGRESS = "in_progress",
|
|
19
|
-
AGREED = "agreed",
|
|
20
|
-
REJECTED = "rejected",
|
|
21
|
-
TIMEOUT = "timeout"
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Negotiation Proposal
|
|
25
|
-
*/
|
|
26
|
-
export interface NegotiationProposal {
|
|
27
|
-
proposalId: string;
|
|
28
|
-
negotiationType: "payment" | "service" | "delivery";
|
|
29
|
-
from: string;
|
|
30
|
-
to: string;
|
|
31
|
-
currentOffer: any;
|
|
32
|
-
history: NegotiationEntry[];
|
|
33
|
-
state: NegotiationState;
|
|
34
|
-
createdAt: number;
|
|
35
|
-
expiresAt: number;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Negotiation Entry in History
|
|
39
|
-
*/
|
|
40
|
-
export interface NegotiationEntry {
|
|
41
|
-
timestamp: number;
|
|
42
|
-
agentId: string;
|
|
43
|
-
action: "propose" | "counter" | "accept" | "reject";
|
|
44
|
-
proposal: any;
|
|
45
|
-
message?: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A2A Negotiation Protocol Implementation
|
|
49
|
-
*/
|
|
50
|
-
export declare class A2ANegotiation {
|
|
51
|
-
private a2a;
|
|
52
|
-
private negotiations;
|
|
53
|
-
private readonly NEGOTIATION_TIMEOUT;
|
|
54
|
-
constructor(a2a: A2AProtocol);
|
|
55
|
-
/**
|
|
56
|
-
* Start a new negotiation
|
|
57
|
-
*/
|
|
58
|
-
startNegotiation(negotiationType: "payment" | "service" | "delivery", receiverAgentId: string, initialOffer: any): string;
|
|
59
|
-
/**
|
|
60
|
-
* Process incoming negotiation message
|
|
61
|
-
*/
|
|
62
|
-
processNegotiationMessage(message: A2AMessage): Promise<A2ANegotiationResult | null>;
|
|
63
|
-
/**
|
|
64
|
-
* Process counter-offer
|
|
65
|
-
*/
|
|
66
|
-
private processCounterOffer;
|
|
67
|
-
/**
|
|
68
|
-
* Process acceptance
|
|
69
|
-
*/
|
|
70
|
-
private processAcceptance;
|
|
71
|
-
/**
|
|
72
|
-
* Process rejection
|
|
73
|
-
*/
|
|
74
|
-
private processRejection;
|
|
75
|
-
/**
|
|
76
|
-
* Counter-offer in an existing negotiation
|
|
77
|
-
*/
|
|
78
|
-
sendCounterOffer(proposalId: string, counterOffer: any): Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Accept a negotiation
|
|
81
|
-
*/
|
|
82
|
-
acceptNegotiation(proposalId: string): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Get negotiation by ID
|
|
85
|
-
*/
|
|
86
|
-
getNegotiation(proposalId: string): NegotiationProposal | null;
|
|
87
|
-
/**
|
|
88
|
-
* Get all active negotiations
|
|
89
|
-
*/
|
|
90
|
-
getActiveNegotiations(): NegotiationProposal[];
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Negotiation Result
|
|
94
|
-
*/
|
|
95
|
-
export interface A2ANegotiationResult {
|
|
96
|
-
proposalId: string;
|
|
97
|
-
state: NegotiationState;
|
|
98
|
-
currentOffer: any;
|
|
99
|
-
action: "counter" | "accept" | "reject";
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Payment Negotiation Example Flow:
|
|
103
|
-
*
|
|
104
|
-
* SettlementAgent: "I propose 1 USDC payment"
|
|
105
|
-
* → creates negotiation with proposalId: "pay-123"
|
|
106
|
-
* → sends A2A request with initialOffer: { amount: 1, currency: "USDC" }
|
|
107
|
-
*
|
|
108
|
-
* MerchantAgent: "I counter-propose 1.5 USDC"
|
|
109
|
-
* → receives negotiation "pay-123"
|
|
110
|
-
* → calls processCounterOffer with proposal: { amount: 1.5, currency: "USDC" }
|
|
111
|
-
* → sends A2A request back with counter offer
|
|
112
|
-
*
|
|
113
|
-
* SettlementAgent: "I accept 1.2 USDC"
|
|
114
|
-
* → receives counter offer
|
|
115
|
-
* → sends A2A response with final offer: { amount: 1.2, currency: "USDC" }
|
|
116
|
-
*
|
|
117
|
-
* MerchantAgent: "Agreed, proceed with 1.2 USDC"
|
|
118
|
-
* → calls acceptNegotiation("pay-123")
|
|
119
|
-
* → negotiation.state becomes AGREED
|
|
120
|
-
* → settlement proceeds
|
|
121
|
-
*/
|
|
122
|
-
//# sourceMappingURL=A2ANegotiation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A2ANegotiation.d.ts","sourceRoot":"","sources":["../../../src/protocols/A2ANegotiation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,W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G;YACW,gBAAgB;IAsB9B;;OAEG;IACG,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB5E;;OAEG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB1D;;OAEG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI;IAI9D;;OAEG;IACH,qBAAqB,IAAI,mBAAmB,EAAE;CAI/C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,gBAAgB,CAAA;IACvB,YAAY,EAAE,GAAG,CAAA;IACjB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;CACxC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* A2A Agent Negotiation Protocol
|
|
4
|
-
*
|
|
5
|
-
* This module implements negotiation logic for agents to:
|
|
6
|
-
* - Negotiate payment terms
|
|
7
|
-
* - Handle counter-offers
|
|
8
|
-
* - Manage negotiation timeouts
|
|
9
|
-
* - Track negotiation history
|
|
10
|
-
*
|
|
11
|
-
* Used for the hackathon bounty "Best Use of Hedera Agent Kit & Google A2A"
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.A2ANegotiation = exports.NegotiationState = void 0;
|
|
18
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
-
/**
|
|
20
|
-
* Negotiation State
|
|
21
|
-
*/
|
|
22
|
-
var NegotiationState;
|
|
23
|
-
(function (NegotiationState) {
|
|
24
|
-
NegotiationState["PENDING"] = "pending";
|
|
25
|
-
NegotiationState["IN_PROGRESS"] = "in_progress";
|
|
26
|
-
NegotiationState["AGREED"] = "agreed";
|
|
27
|
-
NegotiationState["REJECTED"] = "rejected";
|
|
28
|
-
NegotiationState["TIMEOUT"] = "timeout";
|
|
29
|
-
})(NegotiationState || (exports.NegotiationState = NegotiationState = {}));
|
|
30
|
-
/**
|
|
31
|
-
* A2A Negotiation Protocol Implementation
|
|
32
|
-
*/
|
|
33
|
-
class A2ANegotiation {
|
|
34
|
-
a2a;
|
|
35
|
-
negotiations = new Map();
|
|
36
|
-
NEGOTIATION_TIMEOUT = 60000; // 60 seconds
|
|
37
|
-
constructor(a2a) {
|
|
38
|
-
this.a2a = a2a;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Start a new negotiation
|
|
42
|
-
*/
|
|
43
|
-
startNegotiation(negotiationType, receiverAgentId, initialOffer) {
|
|
44
|
-
const proposalId = `negotiation-${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
45
|
-
const proposal = {
|
|
46
|
-
proposalId,
|
|
47
|
-
negotiationType,
|
|
48
|
-
from: this.a2a['agentId'],
|
|
49
|
-
to: receiverAgentId,
|
|
50
|
-
currentOffer: initialOffer,
|
|
51
|
-
history: [{
|
|
52
|
-
timestamp: Date.now(),
|
|
53
|
-
agentId: this.a2a['agentId'],
|
|
54
|
-
action: "propose",
|
|
55
|
-
proposal: initialOffer
|
|
56
|
-
}],
|
|
57
|
-
state: NegotiationState.PENDING,
|
|
58
|
-
createdAt: Date.now(),
|
|
59
|
-
expiresAt: Date.now() + this.NEGOTIATION_TIMEOUT
|
|
60
|
-
};
|
|
61
|
-
this.negotiations.set(proposalId, proposal);
|
|
62
|
-
// Set timeout
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
if (this.negotiations.has(proposalId)) {
|
|
65
|
-
const neg = this.negotiations.get(proposalId);
|
|
66
|
-
if (neg.state === NegotiationState.PENDING || neg.state === NegotiationState.IN_PROGRESS) {
|
|
67
|
-
neg.state = NegotiationState.TIMEOUT;
|
|
68
|
-
console.log(chalk_1.default.yellow(`⏰ Negotiation ${proposalId} timed out`));
|
|
69
|
-
this.negotiations.set(proposalId, neg);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, this.NEGOTIATION_TIMEOUT);
|
|
73
|
-
console.log(chalk_1.default.blue(`🚀 Starting ${negotiationType} negotiation ${proposalId}`));
|
|
74
|
-
return proposalId;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Process incoming negotiation message
|
|
78
|
-
*/
|
|
79
|
-
async processNegotiationMessage(message) {
|
|
80
|
-
const payload = message.payload;
|
|
81
|
-
if (!payload || payload.type !== "negotiation") {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
const action = payload.action;
|
|
85
|
-
const proposalId = payload.proposalId;
|
|
86
|
-
console.log(chalk_1.default.blue(`💬 Processing negotiation ${action} for ${proposalId}`));
|
|
87
|
-
const negotiation = this.negotiations.get(proposalId);
|
|
88
|
-
if (!negotiation) {
|
|
89
|
-
console.log(chalk_1.default.yellow(`⚠️ Unknown negotiation ${proposalId}`));
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
switch (action) {
|
|
93
|
-
case "counter":
|
|
94
|
-
return await this.processCounterOffer(negotiation, payload.proposal);
|
|
95
|
-
case "accept":
|
|
96
|
-
return await this.processAcceptance(negotiation);
|
|
97
|
-
case "reject":
|
|
98
|
-
return await this.processRejection(negotiation);
|
|
99
|
-
default:
|
|
100
|
-
console.log(chalk_1.default.yellow(`⚠️ Unknown action: ${action}`));
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Process counter-offer
|
|
106
|
-
*/
|
|
107
|
-
async processCounterOffer(negotiation, proposal) {
|
|
108
|
-
negotiation.currentOffer = proposal;
|
|
109
|
-
negotiation.state = NegotiationState.IN_PROGRESS;
|
|
110
|
-
negotiation.history.push({
|
|
111
|
-
timestamp: Date.now(),
|
|
112
|
-
agentId: negotiation.to,
|
|
113
|
-
action: "counter",
|
|
114
|
-
proposal
|
|
115
|
-
});
|
|
116
|
-
this.negotiations.set(negotiation.proposalId, negotiation);
|
|
117
|
-
console.log(chalk_1.default.yellow(`🔄 Counter-offer received: ${JSON.stringify(proposal)}`));
|
|
118
|
-
return {
|
|
119
|
-
proposalId: negotiation.proposalId,
|
|
120
|
-
state: negotiation.state,
|
|
121
|
-
currentOffer: proposal,
|
|
122
|
-
action: "counter"
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Process acceptance
|
|
127
|
-
*/
|
|
128
|
-
async processAcceptance(negotiation) {
|
|
129
|
-
negotiation.state = NegotiationState.AGREED;
|
|
130
|
-
negotiation.history.push({
|
|
131
|
-
timestamp: Date.now(),
|
|
132
|
-
agentId: negotiation.to,
|
|
133
|
-
action: "accept",
|
|
134
|
-
proposal: negotiation.currentOffer
|
|
135
|
-
});
|
|
136
|
-
this.negotiations.set(negotiation.proposalId, negotiation);
|
|
137
|
-
console.log(chalk_1.default.green(`✅ Negotiation agreed!`));
|
|
138
|
-
return {
|
|
139
|
-
proposalId: negotiation.proposalId,
|
|
140
|
-
state: negotiation.state,
|
|
141
|
-
currentOffer: negotiation.currentOffer,
|
|
142
|
-
action: "accept"
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Process rejection
|
|
147
|
-
*/
|
|
148
|
-
async processRejection(negotiation) {
|
|
149
|
-
negotiation.state = NegotiationState.REJECTED;
|
|
150
|
-
negotiation.history.push({
|
|
151
|
-
timestamp: Date.now(),
|
|
152
|
-
agentId: negotiation.to,
|
|
153
|
-
action: "reject",
|
|
154
|
-
proposal: null
|
|
155
|
-
});
|
|
156
|
-
this.negotiations.set(negotiation.proposalId, negotiation);
|
|
157
|
-
console.log(chalk_1.default.red(`❌ Negotiation rejected`));
|
|
158
|
-
return {
|
|
159
|
-
proposalId: negotiation.proposalId,
|
|
160
|
-
state: negotiation.state,
|
|
161
|
-
currentOffer: negotiation.currentOffer,
|
|
162
|
-
action: "reject"
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Counter-offer in an existing negotiation
|
|
167
|
-
*/
|
|
168
|
-
async sendCounterOffer(proposalId, counterOffer) {
|
|
169
|
-
const negotiation = this.negotiations.get(proposalId);
|
|
170
|
-
if (!negotiation) {
|
|
171
|
-
throw new Error(`Negotiation ${proposalId} not found`);
|
|
172
|
-
}
|
|
173
|
-
await this.a2a.sendMessage(negotiation.to, negotiation.to, "request", {
|
|
174
|
-
type: "negotiation",
|
|
175
|
-
action: "counter",
|
|
176
|
-
proposalId,
|
|
177
|
-
proposal: counterOffer
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Accept a negotiation
|
|
182
|
-
*/
|
|
183
|
-
async acceptNegotiation(proposalId) {
|
|
184
|
-
const negotiation = this.negotiations.get(proposalId);
|
|
185
|
-
if (!negotiation) {
|
|
186
|
-
throw new Error(`Negotiation ${proposalId} not found`);
|
|
187
|
-
}
|
|
188
|
-
await this.a2a.sendMessage(negotiation.to, negotiation.to, "response", {
|
|
189
|
-
type: "negotiation",
|
|
190
|
-
action: "accept",
|
|
191
|
-
proposalId
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Get negotiation by ID
|
|
196
|
-
*/
|
|
197
|
-
getNegotiation(proposalId) {
|
|
198
|
-
return this.negotiations.get(proposalId) || null;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Get all active negotiations
|
|
202
|
-
*/
|
|
203
|
-
getActiveNegotiations() {
|
|
204
|
-
return Array.from(this.negotiations.values())
|
|
205
|
-
.filter(n => n.state === NegotiationState.PENDING || n.state === NegotiationState.IN_PROGRESS);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
exports.A2ANegotiation = A2ANegotiation;
|
|
209
|
-
/**
|
|
210
|
-
* Payment Negotiation Example Flow:
|
|
211
|
-
*
|
|
212
|
-
* SettlementAgent: "I propose 1 USDC payment"
|
|
213
|
-
* → creates negotiation with proposalId: "pay-123"
|
|
214
|
-
* → sends A2A request with initialOffer: { amount: 1, currency: "USDC" }
|
|
215
|
-
*
|
|
216
|
-
* MerchantAgent: "I counter-propose 1.5 USDC"
|
|
217
|
-
* → receives negotiation "pay-123"
|
|
218
|
-
* → calls processCounterOffer with proposal: { amount: 1.5, currency: "USDC" }
|
|
219
|
-
* → sends A2A request back with counter offer
|
|
220
|
-
*
|
|
221
|
-
* SettlementAgent: "I accept 1.2 USDC"
|
|
222
|
-
* → receives counter offer
|
|
223
|
-
* → sends A2A response with final offer: { amount: 1.2, currency: "USDC" }
|
|
224
|
-
*
|
|
225
|
-
* MerchantAgent: "Agreed, proceed with 1.2 USDC"
|
|
226
|
-
* → calls acceptNegotiation("pay-123")
|
|
227
|
-
* → negotiation.state becomes AGREED
|
|
228
|
-
* → settlement proceeds
|
|
229
|
-
*/
|
|
230
|
-
//# sourceMappingURL=A2ANegotiation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A2ANegotiation.js","sourceRoot":"","sources":["../../../src/protocols/A2ANegotiation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;AAGH,kDAAyB;AAEzB;;GAEG;AACH,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,+CAA2B,CAAA;IAC3B,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,uCAAmB,CAAA;AACrB,CAAC,EANW,gBAAgB,gCAAhB,gBAAgB,QAM3B;AA4BD;;GAEG;AACH,MAAa,cAAc;IACjB,GAAG,CAAa;IAChB,YAAY,GAAqC,IAAI,GAAG,EAAE,CAAA;IACjD,mBAAmB,GAAG,KAAK,CAAA,CAAC,aAAa;IAE1D,YAA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;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Hedron Agent SDK - Services Module
|
|
4
|
-
*
|
|
5
|
-
* Export all service classes and utilities
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createRoyaltyTokenForNFTs = exports.TokenService = void 0;
|
|
9
|
-
var TokenService_1 = require("./TokenService");
|
|
10
|
-
Object.defineProperty(exports, "TokenService", { enumerable: true, get: function () { return TokenService_1.TokenService; } });
|
|
11
|
-
var TokenService_2 = require("./TokenService");
|
|
12
|
-
Object.defineProperty(exports, "createRoyaltyTokenForNFTs", { enumerable: true, get: function () { return TokenService_2.createRoyaltyTokenForNFTs; } });
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AACrB,+CAA0D;AAAjD,yHAAA,yBAAyB,OAAA"}
|