@bosonprotocol/core-sdk 1.12.0-alpha.2 → 1.12.0-alpha.3
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/core-sdk.d.ts +30 -0
- package/dist/cjs/core-sdk.d.ts.map +1 -1
- package/dist/cjs/core-sdk.js +131 -1
- package/dist/cjs/core-sdk.js.map +1 -1
- package/dist/cjs/disputes/handler.d.ts +61 -0
- package/dist/cjs/disputes/handler.d.ts.map +1 -0
- package/dist/cjs/disputes/handler.js +104 -0
- package/dist/cjs/disputes/handler.js.map +1 -0
- package/dist/cjs/disputes/index.d.ts +4 -0
- package/dist/cjs/disputes/index.d.ts.map +1 -0
- package/dist/cjs/disputes/index.js +30 -0
- package/dist/cjs/disputes/index.js.map +1 -0
- package/dist/cjs/disputes/interface.d.ts +30 -0
- package/dist/cjs/disputes/interface.d.ts.map +1 -0
- package/dist/cjs/disputes/interface.js +74 -0
- package/dist/cjs/disputes/interface.js.map +1 -0
- package/dist/cjs/disputes/subgraph.d.ts +6 -0
- package/dist/cjs/disputes/subgraph.d.ts.map +1 -0
- package/dist/cjs/disputes/subgraph.js +30 -0
- package/dist/cjs/disputes/subgraph.js.map +1 -0
- package/dist/cjs/subgraph.d.ts +408 -0
- package/dist/cjs/subgraph.d.ts.map +1 -1
- package/dist/cjs/subgraph.js +104 -2
- package/dist/cjs/subgraph.js.map +1 -1
- package/dist/cjs/utils/graphql.d.ts +16 -0
- package/dist/cjs/utils/graphql.d.ts.map +1 -1
- package/dist/esm/core-sdk.d.ts +30 -0
- package/dist/esm/core-sdk.d.ts.map +1 -1
- package/dist/esm/core-sdk.js +110 -1
- package/dist/esm/core-sdk.js.map +1 -1
- package/dist/esm/disputes/handler.d.ts +61 -0
- package/dist/esm/disputes/handler.d.ts.map +1 -0
- package/dist/esm/disputes/handler.js +62 -0
- package/dist/esm/disputes/handler.js.map +1 -0
- package/dist/esm/disputes/index.d.ts +4 -0
- package/dist/esm/disputes/index.d.ts.map +1 -0
- package/dist/esm/disputes/index.js +4 -0
- package/dist/esm/disputes/index.js.map +1 -0
- package/dist/esm/disputes/interface.d.ts +30 -0
- package/dist/esm/disputes/interface.d.ts.map +1 -0
- package/dist/esm/disputes/interface.js +61 -0
- package/dist/esm/disputes/interface.js.map +1 -0
- package/dist/esm/disputes/subgraph.d.ts +6 -0
- package/dist/esm/disputes/subgraph.d.ts.map +1 -0
- package/dist/esm/disputes/subgraph.js +15 -0
- package/dist/esm/disputes/subgraph.js.map +1 -0
- package/dist/esm/subgraph.d.ts +408 -0
- package/dist/esm/subgraph.d.ts.map +1 -1
- package/dist/esm/subgraph.js +102 -0
- package/dist/esm/subgraph.js.map +1 -1
- package/dist/esm/utils/graphql.d.ts +16 -0
- package/dist/esm/utils/graphql.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/core-sdk.ts +168 -1
- package/src/disputes/handler.ts +132 -0
- package/src/disputes/index.ts +3 -0
- package/src/disputes/interface.ts +90 -0
- package/src/disputes/queries.graphql +56 -0
- package/src/disputes/subgraph.ts +34 -0
- package/src/subgraph.ts +503 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { abis } from "@bosonprotocol/common";
|
|
2
|
+
import { Interface } from "@ethersproject/abi";
|
|
3
|
+
import { BigNumberish } from "@ethersproject/bignumber";
|
|
4
|
+
import { BytesLike } from "@ethersproject/bytes";
|
|
5
|
+
|
|
6
|
+
export const bosonDisputeHandlerIface = new Interface(
|
|
7
|
+
abis.IBosonDisputeHandlerABI
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export function encodeDecideDispute(args: {
|
|
11
|
+
exchangeId: BigNumberish;
|
|
12
|
+
buyerPercent: BigNumberish;
|
|
13
|
+
}) {
|
|
14
|
+
return bosonDisputeHandlerIface.encodeFunctionData("decideDispute", [
|
|
15
|
+
args.exchangeId,
|
|
16
|
+
args.buyerPercent
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function encodeEscalateDispute(exchangeId: BigNumberish) {
|
|
21
|
+
return bosonDisputeHandlerIface.encodeFunctionData("escalateDispute", [
|
|
22
|
+
exchangeId
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function encodeExpireDispute(exchangeId: BigNumberish) {
|
|
27
|
+
return bosonDisputeHandlerIface.encodeFunctionData("expireDispute", [
|
|
28
|
+
exchangeId
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function encodeExpireDisputeBatch(exchangeIds: BigNumberish[]) {
|
|
33
|
+
return bosonDisputeHandlerIface.encodeFunctionData("expireDispute", [
|
|
34
|
+
exchangeIds
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function encodeExpireEscalatedDispute(exchangeId: BigNumberish) {
|
|
39
|
+
return bosonDisputeHandlerIface.encodeFunctionData("expireEscalatedDispute", [
|
|
40
|
+
exchangeId
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function encodeExtendDisputeTimeout(args: {
|
|
45
|
+
exchangeId: BigNumberish;
|
|
46
|
+
newDisputeTimeout: BigNumberish;
|
|
47
|
+
}) {
|
|
48
|
+
return bosonDisputeHandlerIface.encodeFunctionData("extendDisputeTimeout", [
|
|
49
|
+
args.exchangeId,
|
|
50
|
+
args.newDisputeTimeout
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function encodeRaiseDispute(args: {
|
|
55
|
+
exchangeId: BigNumberish;
|
|
56
|
+
complaint: string;
|
|
57
|
+
}) {
|
|
58
|
+
return bosonDisputeHandlerIface.encodeFunctionData("raiseDispute", [
|
|
59
|
+
args.exchangeId,
|
|
60
|
+
args.complaint
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function encodeRefuseEscalatedDispute(exchangeId: BigNumberish) {
|
|
65
|
+
return bosonDisputeHandlerIface.encodeFunctionData("refuseEscalatedDispute", [
|
|
66
|
+
exchangeId
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function encodeResolveDispute(args: {
|
|
71
|
+
exchangeId: BigNumberish;
|
|
72
|
+
buyerPercent: BigNumberish;
|
|
73
|
+
sigR: BytesLike;
|
|
74
|
+
sigS: BytesLike;
|
|
75
|
+
sigV: BigNumberish;
|
|
76
|
+
}) {
|
|
77
|
+
return bosonDisputeHandlerIface.encodeFunctionData("resolveDispute", [
|
|
78
|
+
args.exchangeId,
|
|
79
|
+
args.buyerPercent,
|
|
80
|
+
args.sigR,
|
|
81
|
+
args.sigS,
|
|
82
|
+
args.sigV
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function encodeRetractDispute(exchangeId: BigNumberish) {
|
|
87
|
+
return bosonDisputeHandlerIface.encodeFunctionData("retractDispute", [
|
|
88
|
+
exchangeId
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
query getDisputeByIdQuery(
|
|
2
|
+
$disputeId: ID!
|
|
3
|
+
$offersSkip: Int
|
|
4
|
+
$offersFirst: Int
|
|
5
|
+
$offersOrderBy: Offer_orderBy
|
|
6
|
+
$offersOrderDirection: OrderDirection
|
|
7
|
+
$offersFilter: Offer_filter
|
|
8
|
+
$includeOffers: Boolean = false
|
|
9
|
+
) {
|
|
10
|
+
dispute(id: $disputeId) {
|
|
11
|
+
...DisputeFields
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
query getDisputesQuery(
|
|
16
|
+
$disputesSkip: Int
|
|
17
|
+
$disputesFirst: Int
|
|
18
|
+
$disputesOrderBy: Dispute_orderBy
|
|
19
|
+
$disputesOrderDirection: OrderDirection
|
|
20
|
+
$disputesFilter: Dispute_filter
|
|
21
|
+
) {
|
|
22
|
+
disputes(
|
|
23
|
+
skip: $disputesSkip
|
|
24
|
+
first: $disputesFirst
|
|
25
|
+
orderBy: $disputesOrderBy
|
|
26
|
+
orderDirection: $disputesOrderDirection
|
|
27
|
+
where: $disputesFilter
|
|
28
|
+
) {
|
|
29
|
+
...DisputeFields
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fragment DisputeFields on Dispute {
|
|
34
|
+
...BaseDisputeFields
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fragment BaseDisputeFields on Dispute {
|
|
38
|
+
id
|
|
39
|
+
exchangeId
|
|
40
|
+
complaint
|
|
41
|
+
state
|
|
42
|
+
buyerPercent
|
|
43
|
+
disputedDate
|
|
44
|
+
escalatedDate
|
|
45
|
+
finalizedDate
|
|
46
|
+
timeout
|
|
47
|
+
exchange {
|
|
48
|
+
...BaseExchangeFields
|
|
49
|
+
}
|
|
50
|
+
seller {
|
|
51
|
+
...BaseSellerFields
|
|
52
|
+
}
|
|
53
|
+
buyer {
|
|
54
|
+
...BaseBuyerFields
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getSubgraphSdk } from "../utils/graphql";
|
|
2
|
+
import {
|
|
3
|
+
DisputeFieldsFragment,
|
|
4
|
+
GetDisputesQueryQueryVariables,
|
|
5
|
+
GetDisputeByIdQueryQueryVariables
|
|
6
|
+
} from "../subgraph";
|
|
7
|
+
import { BigNumberish } from "@ethersproject/bignumber";
|
|
8
|
+
|
|
9
|
+
export type SingleDisputeQueryVariables = Omit<
|
|
10
|
+
GetDisputeByIdQueryQueryVariables,
|
|
11
|
+
"disputeId"
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
export async function getDisputeById(
|
|
15
|
+
subgraphUrl: string,
|
|
16
|
+
disputeId: BigNumberish,
|
|
17
|
+
queryVars: SingleDisputeQueryVariables = {}
|
|
18
|
+
): Promise<DisputeFieldsFragment> {
|
|
19
|
+
const sdk = getSubgraphSdk(subgraphUrl);
|
|
20
|
+
const { dispute } = await sdk.getDisputeByIdQuery({
|
|
21
|
+
disputeId: disputeId.toString(),
|
|
22
|
+
...queryVars
|
|
23
|
+
});
|
|
24
|
+
return dispute;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function getDisputes(
|
|
28
|
+
subgraphUrl: string,
|
|
29
|
+
queryVars: GetDisputesQueryQueryVariables = {}
|
|
30
|
+
): Promise<DisputeFieldsFragment[]> {
|
|
31
|
+
const sdk = getSubgraphSdk(subgraphUrl);
|
|
32
|
+
const { disputes = [] } = await sdk.getDisputesQuery(queryVars);
|
|
33
|
+
return disputes;
|
|
34
|
+
}
|