Skip to content

Commit

Permalink
fix: try other approach
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizgar91 committed Oct 25, 2023
1 parent 9bd0541 commit 6713d35
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/nevermined/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ export class Account extends Instantiable {
* @returns
*/
public async requestTokens(amount: BigNumberish, txParams?: TxParameters): Promise<string> {
if (!this.nevermined.keeper.dispenser) {
throw new KeeperError('Dispenser not available on this network.')
}
// if (!this.nevermined.keeper.dispenser) {
// throw new KeeperError('Dispenser not available on this network.')
// }
try {
await this.nevermined.keeper.loadDispenserInstance()
await this.nevermined.keeper.loadTokenInstance()
await this.nevermined.keeper.dispenser.requestTokens(amount, this.id, txParams)
} catch (e) {
throw new KeeperError(`Error requesting tokens: ${e}`)
Expand Down
4 changes: 2 additions & 2 deletions src/nevermined/Nevermined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ export class Nevermined extends Instantiable {

// Nevermined main API
try {
instance.keeper = await Keeper.getInstance(instanceConfig)
await instance.keeper.init()
instance.accounts = new AccountsApi(instanceConfig)
instance.agreements = new AgreementsApi(instanceConfig)
instance.provenance = new ProvenanceApi(instanceConfig)
instance.search = new SearchApi(instanceConfig)
instance.services = new ServicesApi(instanceConfig)
instance.utils = new UtilsApi(instanceConfig)
instance.keeper = await Keeper.getInstance(instanceConfig)
await instance.keeper.init()
instance.assets = new AssetsApi(instanceConfig)
instance.compute = new ComputeApi(instanceConfig)
instance.nfts1155 = await NFT1155Api.getInstance(
Expand Down
6 changes: 1 addition & 5 deletions test/nevermined/Accounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ use(spies)

describe('Accounts', () => {
let accounts: AccountsApi
let nevermined: Nevermined

before(async () => {
// eslint-disable-next-line @typescript-eslint/no-extra-semi
nevermined = await Nevermined.getInstance(config)
nevermined.keeper.dispenser = await nevermined.keeper.loadDispenserInstance()
nevermined.keeper.token = await nevermined.keeper.loadTokenInstance()
accounts = nevermined.accounts
;({ accounts } = await Nevermined.getInstance(config))
})

afterEach(() => {
Expand Down

0 comments on commit 6713d35

Please sign in to comment.