@bosonprotocol/core-sdk
Advanced tools
Comparing version 1.6.0-alpha.2 to 1.6.0-alpha.3
import { RawSellerFromSubgraph } from "./types"; | ||
export declare const sellerFieldsFragment = "\nfragment sellerFields on Seller {\n id\n operator\n admin\n clerk\n treasury\n active\n}\n"; | ||
export declare const sellerFieldsFragment = "\nfragment sellerFields on Seller {\n id\n operator\n admin\n clerk\n treasury\n active\n funds(where: {\n tokenAddress: $fundsTokenAddress\n }) {\n availableAmount\n token {\n address\n decimals\n name\n symbol\n }\n }\n}\n"; | ||
export declare const getSellerByOperatorQuery: string; | ||
export declare function getSellerByOperator(subgraphUrl: string, operatorAddress: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByOperator(subgraphUrl: string, operatorAddress: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
export declare const getSellerByAdminQuery: string; | ||
export declare function getSellerByAdmin(subgraphUrl: string, adminAddress: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByAdmin(subgraphUrl: string, adminAddress: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
export declare const getSellerByClerkQuery: string; | ||
export declare function getSellerByClerk(subgraphUrl: string, clerkAddress: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByAddress(subgraphUrl: string, address: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByClerk(subgraphUrl: string, clerkAddress: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByAddress(subgraphUrl: string, address: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
//# sourceMappingURL=subgraph.d.ts.map |
@@ -22,6 +22,17 @@ "use strict"; | ||
active | ||
funds(where: { | ||
tokenAddress: $fundsTokenAddress | ||
}) { | ||
availableAmount | ||
token { | ||
address | ||
decimals | ||
name | ||
symbol | ||
} | ||
} | ||
} | ||
`; | ||
exports.getSellerByOperatorQuery = ` | ||
query GetSellersByOperator($operator: String!) { | ||
query GetSellersByOperator($operator: String!, $fundsTokenAddress: String) { | ||
sellers(where: { | ||
@@ -35,5 +46,8 @@ operator: $operator | ||
`; | ||
function getSellerByOperator(subgraphUrl, operatorAddress) { | ||
function getSellerByOperator(subgraphUrl, operatorAddress, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByOperatorQuery, { operator: operatorAddress }); | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByOperatorQuery, { | ||
operator: operatorAddress, | ||
fundsTokenAddress | ||
}); | ||
return sellers[0]; | ||
@@ -44,3 +58,3 @@ }); | ||
exports.getSellerByAdminQuery = ` | ||
query GetSellersByAdmin($admin: String!) { | ||
query GetSellersByAdmin($admin: String!, $fundsToken: String) { | ||
sellers(where: { | ||
@@ -54,5 +68,8 @@ admin: $admin | ||
`; | ||
function getSellerByAdmin(subgraphUrl, adminAddress) { | ||
function getSellerByAdmin(subgraphUrl, adminAddress, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByAdminQuery, { admin: adminAddress }); | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByAdminQuery, { | ||
admin: adminAddress, | ||
fundsTokenAddress | ||
}); | ||
return sellers[0]; | ||
@@ -63,3 +80,3 @@ }); | ||
exports.getSellerByClerkQuery = ` | ||
query GetSellersByOperator($clerk: String!) { | ||
query GetSellersByOperator($clerk: String!, $fundsToken: String) { | ||
sellers(where: { | ||
@@ -73,5 +90,8 @@ clerk: $clerk | ||
`; | ||
function getSellerByClerk(subgraphUrl, clerkAddress) { | ||
function getSellerByClerk(subgraphUrl, clerkAddress, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByClerkQuery, { clerk: clerkAddress }); | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByClerkQuery, { | ||
clerk: clerkAddress, | ||
fundsTokenAddress | ||
}); | ||
return sellers[0]; | ||
@@ -81,8 +101,8 @@ }); | ||
exports.getSellerByClerk = getSellerByClerk; | ||
function getSellerByAddress(subgraphUrl, address) { | ||
function getSellerByAddress(subgraphUrl, address, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const [operator, admin, clerk] = yield Promise.all([ | ||
getSellerByOperator(subgraphUrl, address), | ||
getSellerByAdmin(subgraphUrl, address), | ||
getSellerByClerk(subgraphUrl, address) | ||
getSellerByOperator(subgraphUrl, address, fundsTokenAddress), | ||
getSellerByAdmin(subgraphUrl, address, fundsTokenAddress), | ||
getSellerByClerk(subgraphUrl, address, fundsTokenAddress) | ||
]); | ||
@@ -89,0 +109,0 @@ return operator || admin || clerk; |
@@ -0,1 +1,2 @@ | ||
import { RawFundsEntityFromSubgraph } from "../funds/types"; | ||
export { CreateSellerArgs } from "@bosonprotocol/common"; | ||
@@ -9,3 +10,4 @@ export declare type RawSellerFromSubgraph = { | ||
active: boolean; | ||
funds: Omit<RawFundsEntityFromSubgraph, "id" | "accountId">[]; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -29,5 +29,5 @@ import { Web3LibAdapter, TransactionResponse, MetadataStorage, AnyMetadata, Log } from "@bosonprotocol/common"; | ||
getMetadata(metadataHashOrUri: string): Promise<AnyMetadata>; | ||
getSellerByOperator(operator: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByClerk(clerk: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByAddress(address: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByOperator(operator: string, fundsTokenAddress?: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByClerk(clerk: string, fundsTokenAddress?: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByAddress(address: string, fundsTokenAddress?: string): Promise<accounts.RawSellerFromSubgraph>; | ||
createSellerAndOffer(sellerToCreate: accounts.CreateSellerArgs, offerToCreate: offers.CreateOfferArgs, overrides?: Partial<{ | ||
@@ -34,0 +34,0 @@ contractAddress: string; |
@@ -82,15 +82,15 @@ "use strict"; | ||
} | ||
getSellerByOperator(operator) { | ||
getSellerByOperator(operator, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return accounts.subgraph.getSellerByOperator(this._subgraphUrl, operator); | ||
return accounts.subgraph.getSellerByOperator(this._subgraphUrl, operator, fundsTokenAddress); | ||
}); | ||
} | ||
getSellerByClerk(clerk) { | ||
getSellerByClerk(clerk, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return accounts.subgraph.getSellerByClerk(this._subgraphUrl, clerk); | ||
return accounts.subgraph.getSellerByClerk(this._subgraphUrl, clerk, fundsTokenAddress); | ||
}); | ||
} | ||
getSellerByAddress(address) { | ||
getSellerByAddress(address, fundsTokenAddress) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return accounts.subgraph.getSellerByAddress(this._subgraphUrl, address); | ||
return accounts.subgraph.getSellerByAddress(this._subgraphUrl, address, fundsTokenAddress); | ||
}); | ||
@@ -97,0 +97,0 @@ } |
import { RawSellerFromSubgraph } from "./types"; | ||
export declare const sellerFieldsFragment = "\nfragment sellerFields on Seller {\n id\n operator\n admin\n clerk\n treasury\n active\n}\n"; | ||
export declare const sellerFieldsFragment = "\nfragment sellerFields on Seller {\n id\n operator\n admin\n clerk\n treasury\n active\n funds(where: {\n tokenAddress: $fundsTokenAddress\n }) {\n availableAmount\n token {\n address\n decimals\n name\n symbol\n }\n }\n}\n"; | ||
export declare const getSellerByOperatorQuery: string; | ||
export declare function getSellerByOperator(subgraphUrl: string, operatorAddress: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByOperator(subgraphUrl: string, operatorAddress: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
export declare const getSellerByAdminQuery: string; | ||
export declare function getSellerByAdmin(subgraphUrl: string, adminAddress: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByAdmin(subgraphUrl: string, adminAddress: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
export declare const getSellerByClerkQuery: string; | ||
export declare function getSellerByClerk(subgraphUrl: string, clerkAddress: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByAddress(subgraphUrl: string, address: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByClerk(subgraphUrl: string, clerkAddress: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
export declare function getSellerByAddress(subgraphUrl: string, address: string, fundsTokenAddress?: string): Promise<RawSellerFromSubgraph>; | ||
//# sourceMappingURL=subgraph.d.ts.map |
@@ -10,6 +10,17 @@ import { fetchSubgraph } from "../utils/subgraph"; | ||
active | ||
funds(where: { | ||
tokenAddress: $fundsTokenAddress | ||
}) { | ||
availableAmount | ||
token { | ||
address | ||
decimals | ||
name | ||
symbol | ||
} | ||
} | ||
} | ||
`; | ||
export const getSellerByOperatorQuery = ` | ||
query GetSellersByOperator($operator: String!) { | ||
query GetSellersByOperator($operator: String!, $fundsTokenAddress: String) { | ||
sellers(where: { | ||
@@ -23,8 +34,11 @@ operator: $operator | ||
`; | ||
export async function getSellerByOperator(subgraphUrl, operatorAddress) { | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByOperatorQuery, { operator: operatorAddress }); | ||
export async function getSellerByOperator(subgraphUrl, operatorAddress, fundsTokenAddress) { | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByOperatorQuery, { | ||
operator: operatorAddress, | ||
fundsTokenAddress | ||
}); | ||
return sellers[0]; | ||
} | ||
export const getSellerByAdminQuery = ` | ||
query GetSellersByAdmin($admin: String!) { | ||
query GetSellersByAdmin($admin: String!, $fundsToken: String) { | ||
sellers(where: { | ||
@@ -38,8 +52,11 @@ admin: $admin | ||
`; | ||
export async function getSellerByAdmin(subgraphUrl, adminAddress) { | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByAdminQuery, { admin: adminAddress }); | ||
export async function getSellerByAdmin(subgraphUrl, adminAddress, fundsTokenAddress) { | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByAdminQuery, { | ||
admin: adminAddress, | ||
fundsTokenAddress | ||
}); | ||
return sellers[0]; | ||
} | ||
export const getSellerByClerkQuery = ` | ||
query GetSellersByOperator($clerk: String!) { | ||
query GetSellersByOperator($clerk: String!, $fundsToken: String) { | ||
sellers(where: { | ||
@@ -53,11 +70,14 @@ clerk: $clerk | ||
`; | ||
export async function getSellerByClerk(subgraphUrl, clerkAddress) { | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByClerkQuery, { clerk: clerkAddress }); | ||
export async function getSellerByClerk(subgraphUrl, clerkAddress, fundsTokenAddress) { | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByClerkQuery, { | ||
clerk: clerkAddress, | ||
fundsTokenAddress | ||
}); | ||
return sellers[0]; | ||
} | ||
export async function getSellerByAddress(subgraphUrl, address) { | ||
export async function getSellerByAddress(subgraphUrl, address, fundsTokenAddress) { | ||
const [operator, admin, clerk] = await Promise.all([ | ||
getSellerByOperator(subgraphUrl, address), | ||
getSellerByAdmin(subgraphUrl, address), | ||
getSellerByClerk(subgraphUrl, address) | ||
getSellerByOperator(subgraphUrl, address, fundsTokenAddress), | ||
getSellerByAdmin(subgraphUrl, address, fundsTokenAddress), | ||
getSellerByClerk(subgraphUrl, address, fundsTokenAddress) | ||
]); | ||
@@ -64,0 +84,0 @@ return operator || admin || clerk; |
@@ -0,1 +1,2 @@ | ||
import { RawFundsEntityFromSubgraph } from "../funds/types"; | ||
export { CreateSellerArgs } from "@bosonprotocol/common"; | ||
@@ -9,3 +10,4 @@ export declare type RawSellerFromSubgraph = { | ||
active: boolean; | ||
funds: Omit<RawFundsEntityFromSubgraph, "id" | "accountId">[]; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -29,5 +29,5 @@ import { Web3LibAdapter, TransactionResponse, MetadataStorage, AnyMetadata, Log } from "@bosonprotocol/common"; | ||
getMetadata(metadataHashOrUri: string): Promise<AnyMetadata>; | ||
getSellerByOperator(operator: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByClerk(clerk: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByAddress(address: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByOperator(operator: string, fundsTokenAddress?: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByClerk(clerk: string, fundsTokenAddress?: string): Promise<accounts.RawSellerFromSubgraph>; | ||
getSellerByAddress(address: string, fundsTokenAddress?: string): Promise<accounts.RawSellerFromSubgraph>; | ||
createSellerAndOffer(sellerToCreate: accounts.CreateSellerArgs, offerToCreate: offers.CreateOfferArgs, overrides?: Partial<{ | ||
@@ -34,0 +34,0 @@ contractAddress: string; |
@@ -48,10 +48,10 @@ import { getDefaultConfig } from "@bosonprotocol/common"; | ||
} | ||
async getSellerByOperator(operator) { | ||
return accounts.subgraph.getSellerByOperator(this._subgraphUrl, operator); | ||
async getSellerByOperator(operator, fundsTokenAddress) { | ||
return accounts.subgraph.getSellerByOperator(this._subgraphUrl, operator, fundsTokenAddress); | ||
} | ||
async getSellerByClerk(clerk) { | ||
return accounts.subgraph.getSellerByClerk(this._subgraphUrl, clerk); | ||
async getSellerByClerk(clerk, fundsTokenAddress) { | ||
return accounts.subgraph.getSellerByClerk(this._subgraphUrl, clerk, fundsTokenAddress); | ||
} | ||
async getSellerByAddress(address) { | ||
return accounts.subgraph.getSellerByAddress(this._subgraphUrl, address); | ||
async getSellerByAddress(address, fundsTokenAddress) { | ||
return accounts.subgraph.getSellerByAddress(this._subgraphUrl, address, fundsTokenAddress); | ||
} | ||
@@ -58,0 +58,0 @@ async createSellerAndOffer(sellerToCreate, offerToCreate, overrides = {}) { |
{ | ||
"name": "@bosonprotocol/core-sdk", | ||
"version": "1.6.0-alpha.2", | ||
"version": "1.6.0-alpha.3", | ||
"description": "> TODO: description", | ||
@@ -33,3 +33,3 @@ "main": "./dist/cjs/index.js", | ||
"dependencies": { | ||
"@bosonprotocol/common": "^1.6.0-alpha.2", | ||
"@bosonprotocol/common": "^1.6.0-alpha.3", | ||
"@ethersproject/abi": "^5.5.0", | ||
@@ -50,3 +50,3 @@ "@ethersproject/address": "^5.5.0", | ||
}, | ||
"gitHead": "a6eeba9df495ec4526841bd8a063da5b6ad437bd" | ||
"gitHead": "013bc427d0c100cdaa6c55631440f7b83d720726" | ||
} |
@@ -12,2 +12,13 @@ import { fetchSubgraph } from "../utils/subgraph"; | ||
active | ||
funds(where: { | ||
tokenAddress: $fundsTokenAddress | ||
}) { | ||
availableAmount | ||
token { | ||
address | ||
decimals | ||
name | ||
symbol | ||
} | ||
} | ||
} | ||
@@ -17,3 +28,3 @@ `; | ||
export const getSellerByOperatorQuery = ` | ||
query GetSellersByOperator($operator: String!) { | ||
query GetSellersByOperator($operator: String!, $fundsTokenAddress: String) { | ||
sellers(where: { | ||
@@ -30,7 +41,11 @@ operator: $operator | ||
subgraphUrl: string, | ||
operatorAddress: string | ||
operatorAddress: string, | ||
fundsTokenAddress?: string | ||
): Promise<RawSellerFromSubgraph> { | ||
const { sellers = [] } = await fetchSubgraph<{ | ||
sellers: RawSellerFromSubgraph[]; | ||
}>(subgraphUrl, getSellerByOperatorQuery, { operator: operatorAddress }); | ||
}>(subgraphUrl, getSellerByOperatorQuery, { | ||
operator: operatorAddress, | ||
fundsTokenAddress | ||
}); | ||
@@ -41,3 +56,3 @@ return sellers[0]; | ||
export const getSellerByAdminQuery = ` | ||
query GetSellersByAdmin($admin: String!) { | ||
query GetSellersByAdmin($admin: String!, $fundsToken: String) { | ||
sellers(where: { | ||
@@ -54,7 +69,11 @@ admin: $admin | ||
subgraphUrl: string, | ||
adminAddress: string | ||
adminAddress: string, | ||
fundsTokenAddress?: string | ||
): Promise<RawSellerFromSubgraph> { | ||
const { sellers = [] } = await fetchSubgraph<{ | ||
sellers: RawSellerFromSubgraph[]; | ||
}>(subgraphUrl, getSellerByAdminQuery, { admin: adminAddress }); | ||
}>(subgraphUrl, getSellerByAdminQuery, { | ||
admin: adminAddress, | ||
fundsTokenAddress | ||
}); | ||
@@ -65,3 +84,3 @@ return sellers[0]; | ||
export const getSellerByClerkQuery = ` | ||
query GetSellersByOperator($clerk: String!) { | ||
query GetSellersByOperator($clerk: String!, $fundsToken: String) { | ||
sellers(where: { | ||
@@ -78,7 +97,11 @@ clerk: $clerk | ||
subgraphUrl: string, | ||
clerkAddress: string | ||
clerkAddress: string, | ||
fundsTokenAddress?: string | ||
): Promise<RawSellerFromSubgraph> { | ||
const { sellers = [] } = await fetchSubgraph<{ | ||
sellers: RawSellerFromSubgraph[]; | ||
}>(subgraphUrl, getSellerByClerkQuery, { clerk: clerkAddress }); | ||
}>(subgraphUrl, getSellerByClerkQuery, { | ||
clerk: clerkAddress, | ||
fundsTokenAddress | ||
}); | ||
@@ -90,8 +113,9 @@ return sellers[0]; | ||
subgraphUrl: string, | ||
address: string | ||
address: string, | ||
fundsTokenAddress?: string | ||
): Promise<RawSellerFromSubgraph> { | ||
const [operator, admin, clerk] = await Promise.all([ | ||
getSellerByOperator(subgraphUrl, address), | ||
getSellerByAdmin(subgraphUrl, address), | ||
getSellerByClerk(subgraphUrl, address) | ||
getSellerByOperator(subgraphUrl, address, fundsTokenAddress), | ||
getSellerByAdmin(subgraphUrl, address, fundsTokenAddress), | ||
getSellerByClerk(subgraphUrl, address, fundsTokenAddress) | ||
]); | ||
@@ -98,0 +122,0 @@ |
@@ -0,1 +1,3 @@ | ||
import { RawFundsEntityFromSubgraph } from "../funds/types"; | ||
export { CreateSellerArgs } from "@bosonprotocol/common"; | ||
@@ -10,2 +12,3 @@ | ||
active: boolean; | ||
funds: Omit<RawFundsEntityFromSubgraph, "id" | "accountId">[]; | ||
}; |
@@ -81,17 +81,32 @@ import { | ||
public async getSellerByOperator( | ||
operator: string | ||
operator: string, | ||
fundsTokenAddress?: string | ||
): Promise<accounts.RawSellerFromSubgraph> { | ||
return accounts.subgraph.getSellerByOperator(this._subgraphUrl, operator); | ||
return accounts.subgraph.getSellerByOperator( | ||
this._subgraphUrl, | ||
operator, | ||
fundsTokenAddress | ||
); | ||
} | ||
public async getSellerByClerk( | ||
clerk: string | ||
clerk: string, | ||
fundsTokenAddress?: string | ||
): Promise<accounts.RawSellerFromSubgraph> { | ||
return accounts.subgraph.getSellerByClerk(this._subgraphUrl, clerk); | ||
return accounts.subgraph.getSellerByClerk( | ||
this._subgraphUrl, | ||
clerk, | ||
fundsTokenAddress | ||
); | ||
} | ||
public async getSellerByAddress( | ||
address: string | ||
address: string, | ||
fundsTokenAddress?: string | ||
): Promise<accounts.RawSellerFromSubgraph> { | ||
return accounts.subgraph.getSellerByAddress(this._subgraphUrl, address); | ||
return accounts.subgraph.getSellerByAddress( | ||
this._subgraphUrl, | ||
address, | ||
fundsTokenAddress | ||
); | ||
} | ||
@@ -98,0 +113,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
236939
3697