@bosonprotocol/core-sdk
Advanced tools
Comparing version 1.6.0-alpha.0 to 1.6.0-alpha.1
@@ -36,3 +36,3 @@ "use strict"; | ||
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 }); | ||
return sellers[0]; | ||
@@ -54,3 +54,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { sellers } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByOperatorQuery, { admin: adminAddress }); | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByAdminQuery, { admin: adminAddress }); | ||
return sellers[0]; | ||
@@ -72,3 +72,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { sellers } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByOperatorQuery, { clerk: clerkAddress }); | ||
const { sellers = [] } = yield (0, subgraph_1.fetchSubgraph)(subgraphUrl, exports.getSellerByClerkQuery, { clerk: clerkAddress }); | ||
return sellers[0]; | ||
@@ -75,0 +75,0 @@ }); |
@@ -5,2 +5,3 @@ import { Web3LibAdapter, TransactionResponse, MetadataStorage, AnyMetadata, Log } from "@bosonprotocol/common"; | ||
import * as offers from "./offers"; | ||
import * as funds from "./funds"; | ||
import { MultiQueryOpts } from "./utils/subgraph"; | ||
@@ -62,3 +63,5 @@ export declare class CoreSDK { | ||
}>): Promise<TransactionResponse>; | ||
depositFunds(sellerId: BigNumberish, fundsAmount: BigNumberish, fundsTokenAddress?: string): Promise<TransactionResponse>; | ||
getFundsByAccountId(accountId: BigNumberish): Promise<funds.RawFundsEntityFromSubgraph[]>; | ||
} | ||
//# sourceMappingURL=core-sdk.d.ts.map |
@@ -37,2 +37,3 @@ "use strict"; | ||
const common_1 = require("@bosonprotocol/common"); | ||
const constants_1 = require("@ethersproject/constants"); | ||
const accounts = __importStar(require("./accounts")); | ||
@@ -43,2 +44,3 @@ const exchanges = __importStar(require("./exchanges")); | ||
const erc20 = __importStar(require("./erc20")); | ||
const funds = __importStar(require("./funds")); | ||
const logs_1 = require("./utils/logs"); | ||
@@ -211,4 +213,20 @@ class CoreSDK { | ||
} | ||
depositFunds(sellerId, fundsAmount, fundsTokenAddress = constants_1.AddressZero) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return funds.handler.depositFunds({ | ||
sellerId, | ||
fundsAmount, | ||
fundsTokenAddress, | ||
contractAddress: this._protocolDiamond, | ||
web3Lib: this._web3Lib | ||
}); | ||
}); | ||
} | ||
getFundsByAccountId(accountId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return funds.subgraph.getFundsByAccountId(this._subgraphUrl, accountId); | ||
}); | ||
} | ||
} | ||
exports.CoreSDK = CoreSDK; | ||
//# sourceMappingURL=core-sdk.js.map |
@@ -7,4 +7,5 @@ export { CoreSDK } from "./core-sdk"; | ||
export * as erc20 from "./erc20"; | ||
export * as funds from "./funds"; | ||
export { defaultConfigs, getDefaultConfig } from "@bosonprotocol/common"; | ||
export { MetadataType, AnyMetadata } from "@bosonprotocol/metadata"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MetadataType = exports.getDefaultConfig = exports.defaultConfigs = exports.erc20 = exports.orchestration = exports.exchanges = exports.accounts = exports.offers = exports.CoreSDK = void 0; | ||
exports.MetadataType = exports.getDefaultConfig = exports.defaultConfigs = exports.funds = exports.erc20 = exports.orchestration = exports.exchanges = exports.accounts = exports.offers = exports.CoreSDK = void 0; | ||
var core_sdk_1 = require("./core-sdk"); | ||
@@ -35,2 +35,3 @@ Object.defineProperty(exports, "CoreSDK", { enumerable: true, get: function () { return core_sdk_1.CoreSDK; } }); | ||
exports.erc20 = __importStar(require("./erc20")); | ||
exports.funds = __importStar(require("./funds")); | ||
var common_1 = require("@bosonprotocol/common"); | ||
@@ -37,0 +38,0 @@ Object.defineProperty(exports, "defaultConfigs", { enumerable: true, get: function () { return common_1.defaultConfigs; } }); |
@@ -23,3 +23,3 @@ import { fetchSubgraph } from "../utils/subgraph"; | ||
export async function getSellerByOperator(subgraphUrl, operatorAddress) { | ||
const { sellers } = await fetchSubgraph(subgraphUrl, getSellerByOperatorQuery, { operator: operatorAddress }); | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByOperatorQuery, { operator: operatorAddress }); | ||
return sellers[0]; | ||
@@ -38,3 +38,3 @@ } | ||
export async function getSellerByAdmin(subgraphUrl, adminAddress) { | ||
const { sellers } = await fetchSubgraph(subgraphUrl, getSellerByOperatorQuery, { admin: adminAddress }); | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByAdminQuery, { admin: adminAddress }); | ||
return sellers[0]; | ||
@@ -53,3 +53,3 @@ } | ||
export async function getSellerByClerk(subgraphUrl, clerkAddress) { | ||
const { sellers } = await fetchSubgraph(subgraphUrl, getSellerByOperatorQuery, { clerk: clerkAddress }); | ||
const { sellers = [] } = await fetchSubgraph(subgraphUrl, getSellerByClerkQuery, { clerk: clerkAddress }); | ||
return sellers[0]; | ||
@@ -56,0 +56,0 @@ } |
@@ -5,2 +5,3 @@ import { Web3LibAdapter, TransactionResponse, MetadataStorage, AnyMetadata, Log } from "@bosonprotocol/common"; | ||
import * as offers from "./offers"; | ||
import * as funds from "./funds"; | ||
import { MultiQueryOpts } from "./utils/subgraph"; | ||
@@ -62,3 +63,5 @@ export declare class CoreSDK { | ||
}>): Promise<TransactionResponse>; | ||
depositFunds(sellerId: BigNumberish, fundsAmount: BigNumberish, fundsTokenAddress?: string): Promise<TransactionResponse>; | ||
getFundsByAccountId(accountId: BigNumberish): Promise<funds.RawFundsEntityFromSubgraph[]>; | ||
} | ||
//# sourceMappingURL=core-sdk.d.ts.map |
import { getDefaultConfig } from "@bosonprotocol/common"; | ||
import { AddressZero } from "@ethersproject/constants"; | ||
import * as accounts from "./accounts"; | ||
@@ -7,2 +8,3 @@ import * as exchanges from "./exchanges"; | ||
import * as erc20 from "./erc20"; | ||
import * as funds from "./funds"; | ||
import { getValueFromLogs } from "./utils/logs"; | ||
@@ -152,3 +154,15 @@ export class CoreSDK { | ||
} | ||
async depositFunds(sellerId, fundsAmount, fundsTokenAddress = AddressZero) { | ||
return funds.handler.depositFunds({ | ||
sellerId, | ||
fundsAmount, | ||
fundsTokenAddress, | ||
contractAddress: this._protocolDiamond, | ||
web3Lib: this._web3Lib | ||
}); | ||
} | ||
async getFundsByAccountId(accountId) { | ||
return funds.subgraph.getFundsByAccountId(this._subgraphUrl, accountId); | ||
} | ||
} | ||
//# sourceMappingURL=core-sdk.js.map |
@@ -7,4 +7,5 @@ export { CoreSDK } from "./core-sdk"; | ||
export * as erc20 from "./erc20"; | ||
export * as funds from "./funds"; | ||
export { defaultConfigs, getDefaultConfig } from "@bosonprotocol/common"; | ||
export { MetadataType, AnyMetadata } from "@bosonprotocol/metadata"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,4 +7,5 @@ export { CoreSDK } from "./core-sdk"; | ||
export * as erc20 from "./erc20"; | ||
export * as funds from "./funds"; | ||
export { defaultConfigs, getDefaultConfig } from "@bosonprotocol/common"; | ||
export { MetadataType } from "@bosonprotocol/metadata"; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@bosonprotocol/core-sdk", | ||
"version": "1.6.0-alpha.0", | ||
"version": "1.6.0-alpha.1", | ||
"description": "> TODO: description", | ||
@@ -33,3 +33,3 @@ "main": "./dist/cjs/index.js", | ||
"dependencies": { | ||
"@bosonprotocol/common": "^1.6.0-alpha.0", | ||
"@bosonprotocol/common": "^1.6.0-alpha.1", | ||
"@ethersproject/abi": "^5.5.0", | ||
@@ -50,3 +50,3 @@ "@ethersproject/address": "^5.5.0", | ||
}, | ||
"gitHead": "4567c4e3c80795f81eeaf9dcb6173e50b406558f" | ||
"gitHead": "a6b9522306908975de38960fb7b31f8144eeed60" | ||
} |
@@ -30,7 +30,5 @@ import { fetchSubgraph } from "../utils/subgraph"; | ||
): Promise<RawSellerFromSubgraph> { | ||
const { sellers } = await fetchSubgraph<{ sellers: RawSellerFromSubgraph }>( | ||
subgraphUrl, | ||
getSellerByOperatorQuery, | ||
{ operator: operatorAddress } | ||
); | ||
const { sellers = [] } = await fetchSubgraph<{ | ||
sellers: RawSellerFromSubgraph[]; | ||
}>(subgraphUrl, getSellerByOperatorQuery, { operator: operatorAddress }); | ||
@@ -55,7 +53,5 @@ return sellers[0]; | ||
): Promise<RawSellerFromSubgraph> { | ||
const { sellers } = await fetchSubgraph<{ sellers: RawSellerFromSubgraph }>( | ||
subgraphUrl, | ||
getSellerByOperatorQuery, | ||
{ admin: adminAddress } | ||
); | ||
const { sellers = [] } = await fetchSubgraph<{ | ||
sellers: RawSellerFromSubgraph[]; | ||
}>(subgraphUrl, getSellerByAdminQuery, { admin: adminAddress }); | ||
@@ -80,7 +76,5 @@ return sellers[0]; | ||
): Promise<RawSellerFromSubgraph> { | ||
const { sellers } = await fetchSubgraph<{ sellers: RawSellerFromSubgraph }>( | ||
subgraphUrl, | ||
getSellerByOperatorQuery, | ||
{ clerk: clerkAddress } | ||
); | ||
const { sellers = [] } = await fetchSubgraph<{ | ||
sellers: RawSellerFromSubgraph[]; | ||
}>(subgraphUrl, getSellerByClerkQuery, { clerk: clerkAddress }); | ||
@@ -87,0 +81,0 @@ return sellers[0]; |
@@ -10,2 +10,4 @@ import { | ||
import { BigNumberish } from "@ethersproject/bignumber"; | ||
import { AddressZero } from "@ethersproject/constants"; | ||
import * as accounts from "./accounts"; | ||
@@ -16,2 +18,3 @@ import * as exchanges from "./exchanges"; | ||
import * as erc20 from "./erc20"; | ||
import * as funds from "./funds"; | ||
import { getValueFromLogs } from "./utils/logs"; | ||
@@ -256,2 +259,22 @@ import { MultiQueryOpts } from "./utils/subgraph"; | ||
} | ||
public async depositFunds( | ||
sellerId: BigNumberish, | ||
fundsAmount: BigNumberish, | ||
fundsTokenAddress: string = AddressZero | ||
): Promise<TransactionResponse> { | ||
return funds.handler.depositFunds({ | ||
sellerId, | ||
fundsAmount, | ||
fundsTokenAddress, | ||
contractAddress: this._protocolDiamond, | ||
web3Lib: this._web3Lib | ||
}); | ||
} | ||
public async getFundsByAccountId( | ||
accountId: BigNumberish | ||
): Promise<funds.RawFundsEntityFromSubgraph[]> { | ||
return funds.subgraph.getFundsByAccountId(this._subgraphUrl, accountId); | ||
} | ||
} |
@@ -8,2 +8,3 @@ export { CoreSDK } from "./core-sdk"; | ||
export * as erc20 from "./erc20"; | ||
export * as funds from "./funds"; | ||
@@ -10,0 +11,0 @@ export { defaultConfigs, getDefaultConfig } from "@bosonprotocol/common"; |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
232831
264
3612