Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

4irelabs-blackchain-smart-contract

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

4irelabs-blackchain-smart-contract - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

1

dist/src/blackchainApi.d.ts

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

raid(dungeon: PublicKey, characterPubkey: PublicKey): Promise<string | BCResult>;
getBattleLog(sign: string): Promise<string | BCResult>;
sendTransaction(buffer: Buffer): Promise<BCResult>;

@@ -22,0 +23,0 @@ lockCharacter(character: PublicKey): Promise<Buffer | BCResult>;

143

dist/src/blackchainApi.js

@@ -100,7 +100,7 @@ "use strict";

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -129,7 +129,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -214,7 +214,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -250,7 +250,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -262,3 +262,2 @@ }

raid(dungeon, characterPubkey) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {

@@ -271,3 +270,3 @@ if (!this.isMut)

if (character === null) {
return { status: false, error: 2 /* NotEnoughTokens */ };
return { status: false, error: types_1.BCErrorEnum.NotEnoughTokens };
}

@@ -306,8 +305,3 @@ const [goldMint, bump] = yield (0, utils_1.getGoldMintPublicKey)(this.programId);

});
yield this.provider.connection.confirmTransaction(sign);
const logs = (_b = (_a = (yield this.provider.connection.getConfirmedTransaction(sign, "confirmed"))) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.logMessages;
if (logs === null || logs === undefined)
throw Error();
const battleLog = logs.filter((x) => x.slice(0, 14) == "Program log: @");
return battleLog[0].slice(16, battleLog[0].length - 1);
return sign;
}

@@ -318,7 +312,9 @@ catch (e) {

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else if (constants_1.ErrorsRegex.AccountNotExist.test(error.message))
BCerror = types_1.BCErrorEnum.AccountNotExist;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.InvalidArgument;
return { status: false, error: BCerror };

@@ -328,2 +324,13 @@ }

}
getBattleLog(sign) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
yield this.provider.connection.confirmTransaction(sign);
const logs = (_b = (_a = (yield this.provider.connection.getConfirmedTransaction(sign, "confirmed"))) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.logMessages;
if (logs === null || logs === undefined)
return { status: false, error: types_1.BCErrorEnum.InvalidArgument };
const battleLog = logs.filter((x) => x.slice(0, 14) == "Program log: @");
return battleLog[0].slice(16, battleLog[0].length - 1);
});
}
sendTransaction(buffer) {

@@ -357,7 +364,7 @@ return __awaiter(this, void 0, void 0, function* () {

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -388,7 +395,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -419,7 +426,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -450,7 +457,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -481,7 +488,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -512,7 +519,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -543,7 +550,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -574,7 +581,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -605,7 +612,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -636,7 +643,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -671,7 +678,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -706,7 +713,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -741,7 +748,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -776,7 +783,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -811,7 +818,7 @@ }

if (constants_1.ErrorsRegex.NotEnoughRooms.test(error.message))
BCerror = 1 /* NotEnoughRooms */;
BCerror = types_1.BCErrorEnum.NotEnoughRooms;
else if (constants_1.ErrorsRegex.NotEnoughTokens.test(error.message))
BCerror = 2 /* NotEnoughTokens */;
BCerror = types_1.BCErrorEnum.NotEnoughTokens;
else
BCerror = 0 /* AccountNotExist */;
BCerror = types_1.BCErrorEnum.AccountNotExist;
return { status: false, error: BCerror };

@@ -818,0 +825,0 @@ }

@@ -92,2 +92,3 @@ export declare const DEFAULT_PUBLIC_KEY = "11111111111111111111111111111111";

NotEnoughRooms: RegExp;
AccountNotExist: RegExp;
};

@@ -82,2 +82,3 @@ "use strict";

NotEnoughRooms: new RegExp("custom program error: 0x0"),
AccountNotExist: new RegExp("Program log: Custom program error: 0xbbf"),
};

@@ -55,7 +55,9 @@ /// <reference types="bn.js" />

};
export declare const enum BCError {
AccountNotExist = 0,
NotEnoughRooms = 1,
NotEnoughTokens = 2
}
export declare const BCErrorEnum: {
AccountNotExist: number;
NotEnoughRooms: number;
NotEnoughTokens: number;
InvalidArgument: number;
};
export declare type BCError = typeof BCErrorEnum[keyof typeof BCErrorEnum];
export declare type Bonus = {

@@ -62,0 +64,0 @@ typ: BonusType;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnemyTypeEnum = exports.EnemyRaceEnum = exports.ShieldsEnum = exports.MainStatEnum = exports.WeaponsWearingTypeEnum = exports.WorldEnum = exports.TrapTypeEnum = exports.DamageTypeEnum = exports.TurnWayEnum = exports.ArmorWearingTypeEnum = exports.StatusEnum = exports.ArmorTypeEnum = exports.WeaponTypeEnum = exports.BonusTypeEnum = exports.StatEnum = exports.DifficultyEnum = exports.ClassEnum = exports.RankEnum = exports.enumEq = void 0;
exports.EnemyTypeEnum = exports.EnemyRaceEnum = exports.ShieldsEnum = exports.MainStatEnum = exports.WeaponsWearingTypeEnum = exports.WorldEnum = exports.TrapTypeEnum = exports.DamageTypeEnum = exports.TurnWayEnum = exports.ArmorWearingTypeEnum = exports.StatusEnum = exports.ArmorTypeEnum = exports.WeaponTypeEnum = exports.BonusTypeEnum = exports.StatEnum = exports.DifficultyEnum = exports.BCErrorEnum = exports.ClassEnum = exports.RankEnum = exports.enumEq = void 0;
function enumEq(fst, snd) {

@@ -23,2 +23,8 @@ return JSON.stringify(fst) === JSON.stringify(snd);

};
exports.BCErrorEnum = {
AccountNotExist: 1,
NotEnoughRooms: 2,
NotEnoughTokens: 3,
InvalidArgument: 4,
};
exports.DifficultyEnum = {

@@ -25,0 +31,0 @@ Easy: { easy: {} },

{
"name": "4irelabs-blackchain-smart-contract",
"version": "0.0.17",
"version": "0.0.18",
"description": "Integration with Solana API",

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc