-
Notifications
You must be signed in to change notification settings - Fork 0
/
adapter.ts
28 lines (21 loc) · 983 Bytes
/
adapter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import type { Address, Expression, ExpressionAdapter, PublicSharing, LanguageContext, AgentService } from "https://esm.sh/@perspect3vism/ad4m@0.5.0";
// Put adapter is responsible for creating a public expression that can be
// shared with others.
class PutAdapter implements PublicSharing {
#agent: AgentService;
// Assign any values to the put adapter here all the initialization goes here
constructor(context: LanguageContext) {
this.#agent = context.agent;
}
// This method is responsible for creating a public expression
async createPublic(data: any): Promise<Address> {}
}
// Adapter is responsible for getting the expression from the network
export default class Adapter implements ExpressionAdapter {
putAdapter: PublicSharing;
constructor(context: LanguageContext) {
this.putAdapter = new PutAdapter(context);
}
// use the expression address to fetch the expression from the network
async get(address: Address): Promise<Expression> {}
}