Socket
Socket
Sign inDemoInstall

4irelabs-blackchain-smart-contract

Package Overview
Dependencies
73
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.49 to 0.0.50

1

dist/src/blackchainApi.d.ts

@@ -105,2 +105,3 @@ /// <reference types="node" />

changeCharacterLot(character: PublicKey, newPrice: number): Promise<Buffer | BCError>;
buyConsumableForGold(type: Potion, amount: number): Promise<Buffer | BCError>;
changeWeaponLot(weapon: PublicKey, newPrice: number): Promise<Buffer | BCError>;

@@ -107,0 +108,0 @@ changeArmorLot(armor: PublicKey, newPrice: number): Promise<Buffer | BCError>;

@@ -117,3 +117,5 @@ export declare const DEFAULT_PUBLIC_KEY = "11111111111111111111111111111111";

NotEnoughSlots: RegExp;
PotionNotAvailable: RegExp;
NotEnoughGold: RegExp;
};
export declare const ErrorsDescription: string[];

@@ -109,2 +109,4 @@ "use strict";

NotEnoughSlots: new RegExp("custom program error: 0x2a"),
PotionNotAvailable: new RegExp("custom program error: 0x2b"),
NotEnoughGold: new RegExp("custom program error: 0x2c"),
};

@@ -141,2 +143,4 @@ exports.ErrorsDescription = [

"Not enough slots for item",
"Potion not available in market",
"Player does not have enough gold",
];

@@ -138,2 +138,4 @@ import * as Anchor from "@project-serum/anchor";

NotEnoughSlots: number;
PotionNotAvailable: number;
NotEnoughGold: number;
};

@@ -140,0 +142,0 @@ export declare type BCError = typeof BCErrorEnum[keyof typeof BCErrorEnum];

@@ -54,2 +54,4 @@ "use strict";

NotEnoughSlots: 28,
PotionNotAvailable: 29,
NotEnoughGold: 30,
};

@@ -56,0 +58,0 @@ exports.DifficultyEnum = {

460

dist/tests/createPlayer.test.js

@@ -43,6 +43,6 @@ "use strict";

// (
// await bc.getCharacter(
// new PublicKey("5ykdtqfVBBpz6VzKxBoJuDs9rDoC9L1p2suJfsio97W")
// await bc.getConsumables(
// new PublicKey("32bfaQGpZBM7P5AhS6TZne4PguKpSfMNTxBtxr7QRAh5")
// )
// )?.leftHand.toString()
// )?.[1].consumables
// );

@@ -111,3 +111,4 @@ // console.log(

test("Hire character", () => __awaiter(void 0, void 0, void 0, function* () {
let tx = yield bc.hireCharacterWithoutSending("Dragon", types_1.ClassEnum.Pyromancer);
//await bc.addRoom();
let tx = yield bc.hireCharacterWithoutSending("Dragon", types_1.ClassEnum.Templar);
expect(typeof tx).not.toBe("number");

@@ -143,132 +144,199 @@ yield bc.sendTransaction(tx[0]);

test("Blind raid", () => __awaiter(void 0, void 0, void 0, function* () {
// for (let i = 0; i < 5; i++) {
const player = (yield bc.getPlayerAccount());
const characterBefore = (yield bc.getCharacter(player.characters[0]));
let tx = yield bc.blindRaid(types_1.DifficultyEnum.Easy, player.characters[0]);
expect(typeof tx).not.toBe("number");
let sign = yield bc.sendTransaction(tx[0]);
expect(typeof sign).toBe("string");
sign = sign;
let battleLog = yield bc.getBattleLog(sign);
expect(typeof battleLog).not.toBe("number");
battleLog = battleLog;
//console.log(battleLog);
let initDungeon = yield bc.getInitialDungeon(sign);
expect(typeof initDungeon).not.toBe("number");
initDungeon = initDungeon;
if (battleLog.complete != 100) {
let dungeon = yield bc.getDungeon(tx[1]);
expect(dungeon).not.toBeNull();
dungeon = dungeon;
expect(battleLog.receivedExp.toString()).toBe(initDungeon.exp.sub(dungeon.exp).toString());
}
else {
expect(battleLog.receivedExp.toString()).toBe(initDungeon.exp.subn(0).toString());
}
const characterAfter = (yield bc.getCharacter(player.characters[0]));
expect(battleLog.receivedExp.toString()).toBe(characterAfter.experience.sub(characterBefore.experience).toString());
//}
}));
test("Set weapon with bonus", () => __awaiter(void 0, void 0, void 0, function* () {
let weapons = (yield bc.getWeaponsList());
let character = (yield bc.getCharactersList())[0];
for (let w of weapons) {
if ((0, types_1.enumEq)(w[1].rank, types_1.RankEnum.Rare) ||
(0, types_1.enumEq)(w[1].rank, types_1.RankEnum.Epic) ||
(0, types_1.enumEq)(w[1].rank, types_1.RankEnum.Legendary) ||
(0, types_1.enumEq)(w[1].rank, types_1.RankEnum.Mythic)) {
let tx = yield bc.unsetWeaponWithoutSending(character[0], character[1].rightHand);
yield bc.sendTransaction(yield bc.instructionsToBuffer([tx]));
let tx1 = yield bc.setWeaponWithoutSending(character[0], w[0]);
yield bc.sendTransaction(yield bc.instructionsToBuffer([tx1]));
break;
for (let i = 0; i < 1; i++) {
const player = (yield bc.getPlayerAccount());
const characterBefore = (yield bc.getCharacter(player.characters[0]));
let tx = yield bc.blindRaid(types_1.DifficultyEnum.Easy, player.characters[0]);
expect(typeof tx).not.toBe("number");
let sign = yield bc.sendTransaction(tx[0]);
expect(typeof sign).toBe("string");
sign = sign;
let battleLog = yield bc.getBattleLog(sign);
expect(typeof battleLog).not.toBe("number");
battleLog = battleLog;
console.log(battleLog);
let initDungeon = yield bc.getInitialDungeon(sign);
expect(typeof initDungeon).not.toBe("number");
initDungeon = initDungeon;
if (battleLog.complete != 100) {
let dungeon = yield bc.getDungeon(tx[1]);
expect(dungeon).not.toBeNull();
dungeon = dungeon;
expect(battleLog.receivedExp.toString()).toBe(initDungeon.exp.sub(dungeon.exp).toString());
}
}
}));
test("Lock material", () => __awaiter(void 0, void 0, void 0, function* () {
let materials = (yield bc.getMaterials())[1];
for (let m of materials.materials) {
if (m.amount.gtn(1)) {
let tx = yield bc.lockMaterial(0.001, 2, m.typ);
expect(typeof tx).not.toBe("number");
yield bc.sendTransaction(tx[0]);
let lot = yield bc.getMaterialLot(tx[1]);
expect(lot).not.toBeNull();
lot = lot;
expect(lot.amount.toNumber()).toBe(2);
expect((0, types_1.enumEq)(lot.typ, m.typ)).toBe(true);
expect(lot.price.toNumber()).toBe(0.001 * Math.pow(10, 9));
expect(lot.isInitialized).toBe(true);
let tx1 = yield bc.changeMaterialLot(tx[1], 0.01, 1);
expect(typeof tx).not.toBe("number");
yield bc.sendTransaction(tx1);
lot = yield bc.getMaterialLot(tx[1]);
expect(lot).not.toBeNull();
lot = lot;
expect(lot.amount.toNumber()).toBe(1);
expect((0, types_1.enumEq)(lot.typ, m.typ)).toBe(true);
expect(lot.price.toNumber()).toBe(0.01 * Math.pow(10, 9));
expect(lot.isInitialized).toBe(true);
let keypair = new web3_js_1.Keypair();
let wallet = new nodewallet_1.default(keypair);
let connection = new anchor_1.web3.Connection(constants_2.cluster, "finalized");
let sign = yield connection.requestAirdrop(keypair.publicKey, 1 * anchor_1.web3.LAMPORTS_PER_SOL);
yield connection.confirmTransaction(sign);
let bcBuyer = new src_1.BC(constants_2.cluster, constants_2.KEY, true, wallet);
yield bcBuyer.createPlayerAccount();
let startSol = yield connection.getBalance(keypair.publicKey, "finalized");
let buyTx = yield bcBuyer.buyMaterial(tx[1], 1);
yield bcBuyer.sendTransaction(buyTx);
let buyMaterial = yield bcBuyer.getMaterials();
expect(buyMaterial).not.toBeNull();
buyMaterial = buyMaterial;
expect(buyMaterial[1].materials[types_1.materialTypeMap.get(JSON.stringify(lot.typ))].amount.toString()).toBe("1");
expect(startSol - 0.01 * Math.pow(10, 9) - 5000).toBe(yield connection.getBalance(keypair.publicKey, "finalized"));
tx1 = yield bcBuyer.deleteMaterial(m.typ, 1);
yield bcBuyer.sendTransaction(tx1);
buyMaterial = yield bcBuyer.getMaterials();
expect(buyMaterial).not.toBeNull();
buyMaterial = buyMaterial;
expect(buyMaterial[1].materials[types_1.materialTypeMap.get(JSON.stringify(lot.typ))].amount.toString()).toBe("0");
break;
else {
expect(battleLog.receivedExp.toString()).toBe(initDungeon.exp.subn(0).toString());
}
const characterAfter = (yield bc.getCharacter(player.characters[0]));
expect(battleLog.receivedExp.toString()).toBe(characterAfter.experience.sub(characterBefore.experience).toString());
}
}));
test("Use potions", () => __awaiter(void 0, void 0, void 0, function* () {
var _a;
let consumables = (yield bc.getConsumables())[1];
for (let m of consumables.consumables) {
if (((0, types_1.enumEq)(m.typ, types_1.PotionEnum.PotionOfClearMind) ||
(0, types_1.enumEq)(m.typ, types_1.PotionEnum.PotionOfHeavyArms) ||
(0, types_1.enumEq)(m.typ, types_1.PotionEnum.PotionOfSneakyCat) ||
(0, types_1.enumEq)(m.typ, types_1.PotionEnum.PotionOfTheHappyFool) ||
(0, types_1.enumEq)(m.typ, types_1.PotionEnum.PotionOfElephant)) &&
m.amount.gtn(0)) {
let characterBefore = (yield bc.getCharactersList())[0];
let tx = yield bc.usePotion(characterBefore[0], m.typ);
expect(typeof tx).not.toBe("number");
yield bc.sendTransaction(tx);
let characterAfter = (yield bc.getCharactersList())[0];
expect((0, types_1.enumEq)((_a = characterAfter[1].potions[0]) === null || _a === void 0 ? void 0 : _a.effect, m.typ)).toBe(true);
let consumables = (yield bc.getConsumables())[1];
expect(consumables.consumables[types_1.consumablesTypeMap.get(JSON.stringify(m.typ))].amount.toString()).toBe(m.amount.subn(1).toString());
break;
}
}
}));
test("Increase stats", () => __awaiter(void 0, void 0, void 0, function* () {
const player = (yield bc.getPlayerAccount());
const characterBefore = (yield bc.getCharacter(player.characters[0]));
let points = characterBefore.skillPoints;
let tx = yield bc.upgradeStatsCharacter(player.characters[0], {
str: points,
});
test("Use golds", () => __awaiter(void 0, void 0, void 0, function* () {
let consumablesBefore = (yield bc.getConsumables());
let gold = yield bc.getGoldCount();
expect(gold).not.toBeNull();
gold = gold;
let tx = yield bc.buyConsumableForGold(types_1.PotionEnum.RejuvenationHoneydew, 1);
expect(typeof tx).not.toBe("number");
yield bc.sendTransaction(tx);
const characterAfter = (yield bc.getCharacter(player.characters[0]));
if (characterBefore.injuryLevel !== 0) {
expect(characterBefore.startsStat[0] + points).toBe(characterAfter.startsStat[0]);
}
else
expect(characterBefore.str + points).toBe(characterAfter.str);
expect(gold.subn(100).toString()).toBe((yield bc.getGoldCount()).toString());
let consumablesAfter = (yield bc.getConsumables());
expect(consumablesBefore[1].consumables[types_1.consumablesTypeMap.get(JSON.stringify(types_1.PotionEnum.RejuvenationHoneydew))].amount.toString()).toBe("0");
expect(consumablesBefore[1].consumables[types_1.consumablesTypeMap.get(JSON.stringify(types_1.PotionEnum.RejuvenationHoneydew))].amount
.addn(1)
.toString()).toBe(consumablesAfter[1].consumables[types_1.consumablesTypeMap.get(JSON.stringify(types_1.PotionEnum.RejuvenationHoneydew))].amount.toString());
let tx1 = yield bc.deleteConsumable(types_1.PotionEnum.RejuvenationHoneydew, 1);
yield bc.sendTransaction(tx1);
consumablesAfter = (yield bc.getConsumables());
expect(consumablesBefore[1].consumables[types_1.consumablesTypeMap.get(JSON.stringify(types_1.PotionEnum.RejuvenationHoneydew))].amount.toString()).toBe(consumablesAfter[1].consumables[types_1.consumablesTypeMap.get(JSON.stringify(types_1.PotionEnum.RejuvenationHoneydew))].amount.toString());
}));
// test("Set weapon with bonus", async () => {
// let weapons = (await bc.getWeaponsList()) as [PublicKey, Weapon][];
// let character = (
// (await bc.getCharactersList()) as [PublicKey, Character][]
// )[0];
// for (let w of weapons) {
// if (
// enumEq(w[1].rank, RankEnum.Rare) ||
// enumEq(w[1].rank, RankEnum.Epic) ||
// enumEq(w[1].rank, RankEnum.Legendary) ||
// enumEq(w[1].rank, RankEnum.Mythic)
// ) {
// let tx = await bc.unsetWeaponWithoutSending(
// character[0],
// character[1].rightHand
// );
// await bc.sendTransaction(await bc.instructionsToBuffer([tx]));
// let tx1 = await bc.setWeaponWithoutSending(character[0], w[0]);
// await bc.sendTransaction(await bc.instructionsToBuffer([tx1]));
// break;
// }
// }
// });
// test("Lock material", async () => {
// let materials = ((await bc.getMaterials()) as [PublicKey, Materials])[1];
// for (let m of materials.materials) {
// if (m.amount.gtn(1)) {
// let tx = await bc.lockMaterial(0.001, 2, m.typ);
// expect(typeof tx).not.toBe("number");
// await bc.sendTransaction(tx[0] as Buffer);
// let lot = await bc.getMaterialLot(tx[1]);
// expect(lot).not.toBeNull();
// lot = lot as MaterialLot;
// expect(lot.amount.toNumber()).toBe(2);
// expect(enumEq(lot.typ, m.typ)).toBe(true);
// expect(lot.price.toNumber()).toBe(0.001 * 10 ** 9);
// expect(lot.isInitialized).toBe(true);
// let tx1 = await bc.changeMaterialLot(tx[1], 0.01, 1);
// expect(typeof tx).not.toBe("number");
// await bc.sendTransaction(tx1 as Buffer);
// lot = await bc.getMaterialLot(tx[1]);
// expect(lot).not.toBeNull();
// lot = lot as MaterialLot;
// expect(lot.amount.toNumber()).toBe(1);
// expect(enumEq(lot.typ, m.typ)).toBe(true);
// expect(lot.price.toNumber()).toBe(0.01 * 10 ** 9);
// expect(lot.isInitialized).toBe(true);
// let keypair = new Keypair();
// let wallet = new NodeWallet(keypair);
// let connection = new web3.Connection(cluster, "finalized");
// let sign = await connection.requestAirdrop(
// keypair.publicKey,
// 1 * web3.LAMPORTS_PER_SOL
// );
// await connection.confirmTransaction(sign);
// let bcBuyer = new BC(cluster, KEY, true, wallet);
// await bcBuyer.createPlayerAccount();
// let startSol = await connection.getBalance(
// keypair.publicKey,
// "finalized"
// );
// let buyTx = await bcBuyer.buyMaterial(tx[1], 1);
// await bcBuyer.sendTransaction(buyTx as Buffer);
// let buyMaterial = await bcBuyer.getMaterials();
// expect(buyMaterial).not.toBeNull();
// buyMaterial = buyMaterial as [PublicKey, Materials];
// expect(
// buyMaterial[1].materials[
// materialTypeMap.get(JSON.stringify(lot.typ))
// ].amount.toString()
// ).toBe("1");
// expect(startSol - 0.01 * 10 ** 9 - 5000).toBe(
// await connection.getBalance(keypair.publicKey, "finalized")
// );
// tx1 = await bcBuyer.deleteMaterial(m.typ, 1);
// await bcBuyer.sendTransaction(tx1 as Buffer);
// buyMaterial = await bcBuyer.getMaterials();
// expect(buyMaterial).not.toBeNull();
// buyMaterial = buyMaterial as [PublicKey, Materials];
// expect(
// buyMaterial[1].materials[
// materialTypeMap.get(JSON.stringify(lot.typ))
// ].amount.toString()
// ).toBe("0");
// let sellMaterial = await bc.getMaterials();
// expect(sellMaterial).not.toBeNull();
// sellMaterial = sellMaterial as [PublicKey, Materials];
// expect(
// sellMaterial[1].materials[
// materialTypeMap.get(JSON.stringify(m.typ))
// ].amount.toString()
// ).toBe(m.amount.subn(1).toString());
// break;
// }
// }
// });
// test("Use potions", async () => {
// let consumables = (
// (await bc.getConsumables()) as [PublicKey, Consumables]
// )[1];
// for (let m of consumables.consumables) {
// if (
// (enumEq(m.typ, PotionEnum.PotionOfClearMind) ||
// enumEq(m.typ, PotionEnum.PotionOfHeavyArms) ||
// enumEq(m.typ, PotionEnum.PotionOfSneakyCat) ||
// enumEq(m.typ, PotionEnum.PotionOfTheHappyFool) ||
// enumEq(m.typ, PotionEnum.PotionOfElephant)) &&
// m.amount.gtn(0)
// ) {
// let characterBefore = (
// (await bc.getCharactersList()) as [PublicKey, Character][]
// )[0];
// let tx = await bc.usePotion(characterBefore[0], m.typ);
// expect(typeof tx).not.toBe("number");
// await bc.sendTransaction(tx as Buffer);
// let characterAfter = (
// (await bc.getCharactersList()) as [PublicKey, Character][]
// )[0];
// expect(enumEq(characterAfter[1].potions[0]?.effect, m.typ)).toBe(true);
// let consumables = (
// (await bc.getConsumables()) as [PublicKey, Consumables]
// )[1];
// expect(
// consumables.consumables[
// consumablesTypeMap.get(JSON.stringify(m.typ))
// ].amount.toString()
// ).toBe(m.amount.subn(1).toString());
// break;
// }
// }
// });
// test("Increase stats", async () => {
// const player = (await bc.getPlayerAccount()) as PlayerAccount;
// const characterBefore = (await bc.getCharacter(
// player.characters[0]
// )) as Character;
// let points = characterBefore.skillPoints;
// let tx = await bc.upgradeStatsCharacter(player.characters[0], {
// str: points,
// });
// await bc.sendTransaction(tx as Buffer);
// const characterAfter = (await bc.getCharacter(
// player.characters[0]
// )) as Character;
// if (characterBefore.injuryLevel !== 0) {
// expect(characterBefore.startsStat[0] + points).toBe(
// characterAfter.startsStat[0]
// );
// } else expect(characterBefore.str + points).toBe(characterAfter.str);
// });
test("Scouting & raid", () => __awaiter(void 0, void 0, void 0, function* () {

@@ -331,63 +399,75 @@ // for (let i = 0; i < 100; i++) {

}));
test("Lock consumable", () => __awaiter(void 0, void 0, void 0, function* () {
let consumables = (yield bc.getConsumables())[1];
for (let m of consumables.consumables) {
if (m.amount.gtn(0)) {
let tx = yield bc.lockConsumable(100, 1, m.typ);
expect(typeof tx).not.toBe("number");
yield bc.sendTransaction(tx[0]);
let lot = yield bc.getConsumableLot(tx[1]);
expect(lot).not.toBeNull();
lot = lot;
expect(lot.amount.toNumber()).toBe(1);
expect((0, types_1.enumEq)(lot.typ, m.typ)).toBe(true);
expect(lot.price.toNumber()).toBe(100 * Math.pow(10, 9));
expect(lot.isInitialized).toBe(true);
let tx1 = yield bc.unlockConsumable(tx[1]);
expect(typeof tx).not.toBe("number");
yield bc.sendTransaction(tx1);
lot = yield bc.getConsumableLot(tx[1]);
expect(lot).toBeNull();
break;
}
}
}));
test("Lock weapon", () => __awaiter(void 0, void 0, void 0, function* () {
let weapons = (yield bc.getWeaponsList());
for (let w of weapons) {
if ((0, types_1.enumEq)(w[1].status, types_1.StatusEnum.Free)) {
let tx = yield bc.lockWeapon(w[0], 0.4);
yield bc.sendTransaction(tx);
let weapon = yield bc.getWeapon(w[0]);
expect(weapon).not.toBeNull();
weapon = weapon;
expect(weapon.price.toNumber()).toBe(0.4 * Math.pow(10, 9));
tx = yield bc.changeWeaponLot(w[0], 0.5);
yield bc.sendTransaction(tx);
weapon = yield bc.getWeapon(w[0]);
expect(weapon).not.toBeNull();
weapon = weapon;
expect(weapon.price.toNumber()).toBe(0.5 * Math.pow(10, 9));
let keypair = new web3_js_1.Keypair();
let wallet = new nodewallet_1.default(keypair);
let connection = new anchor_1.web3.Connection(constants_2.cluster, "finalized");
let sign = yield connection.requestAirdrop(keypair.publicKey, 1 * anchor_1.web3.LAMPORTS_PER_SOL);
yield connection.confirmTransaction(sign);
let bcBuyer = new src_1.BC(constants_2.cluster, constants_2.KEY, true, wallet);
yield bcBuyer.createPlayerAccount();
let startSol = yield connection.getBalance(keypair.publicKey, "finalized");
let buyTx = yield bcBuyer.buyWeapon(w[0]);
yield bcBuyer.sendTransaction(buyTx);
let buyWeapons = yield bcBuyer.getWeaponsList();
expect(buyWeapons).not.toBeNull();
buyWeapons = buyWeapons;
expect(buyWeapons[0][0].toString()).toBe(w[0].toString());
expect(startSol - 0.5 * Math.pow(10, 9) - 5000).toBe(yield connection.getBalance(keypair.publicKey, "finalized"));
let soldWeapon = (yield bcBuyer.getWeapon(w[0]));
expect(soldWeapon.price.toString()).toBe("0");
expect((0, types_1.enumEq)(soldWeapon.status, types_1.StatusEnum.Free)).toBe(true);
expect(soldWeapon.playerAccount.toString()).toBe((yield bc.getPlayerAccountPublicKey(keypair.publicKey)).toString());
break;
}
}
}));
// test("Lock consumable", async () => {
// let consumables = (
// (await bc.getConsumables()) as [PublicKey, Consumables]
// )[1];
// for (let m of consumables.consumables) {
// if (m.amount.gtn(0)) {
// let tx = await bc.lockConsumable(100, 1, m.typ);
// expect(typeof tx).not.toBe("number");
// await bc.sendTransaction(tx[0] as Buffer);
// let lot = await bc.getConsumableLot(tx[1]);
// expect(lot).not.toBeNull();
// lot = lot as ConsumableLot;
// expect(lot.amount.toNumber()).toBe(1);
// expect(enumEq(lot.typ, m.typ)).toBe(true);
// expect(lot.price.toNumber()).toBe(100 * 10 ** 9);
// expect(lot.isInitialized).toBe(true);
// let tx1 = await bc.unlockConsumable(tx[1]);
// expect(typeof tx).not.toBe("number");
// await bc.sendTransaction(tx1 as Buffer);
// lot = await bc.getConsumableLot(tx[1]);
// expect(lot).toBeNull();
// break;
// }
// }
// });
// test("Lock weapon", async () => {
// let weapons = (await bc.getWeaponsList()) as [PublicKey, Weapon][];
// for (let w of weapons) {
// if (enumEq(w[1].status, StatusEnum.Free)) {
// let tx = await bc.lockWeapon(w[0], 0.4);
// await bc.sendTransaction(tx as Buffer);
// let weapon = await bc.getWeapon(w[0]);
// expect(weapon).not.toBeNull();
// weapon = weapon as Weapon;
// expect(weapon.price.toNumber()).toBe(0.4 * 10 ** 9);
// tx = await bc.changeWeaponLot(w[0], 0.5);
// await bc.sendTransaction(tx as Buffer);
// weapon = await bc.getWeapon(w[0]);
// expect(weapon).not.toBeNull();
// weapon = weapon as Weapon;
// expect(weapon.price.toNumber()).toBe(0.5 * 10 ** 9);
// let keypair = new Keypair();
// let wallet = new NodeWallet(keypair);
// let connection = new web3.Connection(cluster, "finalized");
// let sign = await connection.requestAirdrop(
// keypair.publicKey,
// 1 * web3.LAMPORTS_PER_SOL
// );
// await connection.confirmTransaction(sign);
// let bcBuyer = new BC(cluster, KEY, true, wallet);
// await bcBuyer.createPlayerAccount();
// let startSol = await connection.getBalance(
// keypair.publicKey,
// "finalized"
// );
// let buyTx = await bcBuyer.buyWeapon(w[0]);
// await bcBuyer.sendTransaction(buyTx as Buffer);
// let buyWeapons = await bcBuyer.getWeaponsList();
// expect(buyWeapons).not.toBeNull();
// buyWeapons = buyWeapons as [PublicKey, Weapon][];
// expect(buyWeapons[0][0].toString()).toBe(w[0].toString());
// expect(startSol - 0.5 * 10 ** 9 - 5000).toBe(
// await connection.getBalance(keypair.publicKey, "finalized")
// );
// let soldWeapon = (await bcBuyer.getWeapon(w[0])) as Weapon;
// expect(soldWeapon.price.toString()).toBe("0");
// expect(enumEq(soldWeapon.status, StatusEnum.Free)).toBe(true);
// expect(soldWeapon.playerAccount.toString()).toBe(
// (await bc.getPlayerAccountPublicKey(keypair.publicKey)).toString()
// );
// break;
// }
// }
// });
{
"name": "4irelabs-blackchain-smart-contract",
"version": "0.0.49",
"version": "0.0.50",
"description": "Integration with Solana API",

@@ -5,0 +5,0 @@ "author": "",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc