@sentio/sdk 0.1.5 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +1,13 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.MirrorWorldProcessor = void 0;
30
7
  const solana_processor_1 = require("solana_processor");
31
- const fs = __importStar(require("fs"));
32
- const path = __importStar(require("path"));
33
8
  const bs58_1 = __importDefault(require("bs58"));
34
9
  const anchor_1 = require("@project-serum/anchor");
10
+ const game_wallet_1 = require("./types/game_wallet");
35
11
  class MirrorWorldProcessor extends solana_processor_1.SolanaBaseProcessor {
36
12
  static bind(address, endpoint, name = 'MirrorWorld') {
37
13
  return new MirrorWorldProcessor(name, address, endpoint);
@@ -40,23 +16,19 @@ class MirrorWorldProcessor extends solana_processor_1.SolanaBaseProcessor {
40
16
  exports.MirrorWorldProcessor = MirrorWorldProcessor;
41
17
  MirrorWorldProcessor.bind('F78NhTC9XmP1DKsCBRz5LGdQc4n4yFbj2dURiv7T9gGZ', 'https://api.mainnet-beta.solana.com')
42
18
  .onTransaction((txn, ctx) => {
43
- const idlStr = fs.readFileSync(path.join(__dirname, 'solana-abis/mirrorworld.json'));
44
- const idl = JSON.parse(idlStr.toString());
45
- const instructionCoder = new anchor_1.BorshInstructionCoder(idl);
19
+ const instructionCoder = new anchor_1.BorshInstructionCoder(game_wallet_1.game_wallet_idl);
46
20
  for (const instruction of txn.transaction.message.instructions) {
47
21
  const decodedData = instructionCoder.decode(Buffer.from(bs58_1.default.decode(instruction.data)));
48
22
  console.log('instruction name: ' + decodedData?.name);
49
- if (decodedData != null) {
23
+ if (decodedData) {
50
24
  handleDecodedInstruction(decodedData, ctx);
51
25
  }
52
26
  }
53
27
  })
54
28
  .onInstruction((ins, ctx) => {
55
- const idlStr = fs.readFileSync(path.join(__dirname, 'solana-abis/mirrorworld.json'));
56
- const idl = JSON.parse(idlStr.toString());
57
- const instructionCoder = new anchor_1.BorshInstructionCoder(idl);
29
+ const instructionCoder = new anchor_1.BorshInstructionCoder(game_wallet_1.game_wallet_idl);
58
30
  const decodedData = instructionCoder.decode(Buffer.from(bs58_1.default.decode(ins)));
59
- if (decodedData != null) {
31
+ if (decodedData) {
60
32
  handleDecodedInstruction(decodedData, ctx);
61
33
  }
62
34
  })
@@ -1 +1 @@
1
- {"version":3,"file":"mirrorworld.js","sourceRoot":"","sources":["../../src/test_case/mirrorworld.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAsD;AACtD,uCAAwB;AACxB,2CAA4B;AAG5B,gDAAmC;AACnC,kDAA0E;AAG1E,MAAa,oBAAqB,SAAQ,sCAAmB;IAC3D,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,QAAgB,EAAE,IAAI,GAAG,aAAa;QACjE,OA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;YAC5D,MAAK;QACP,KAAK,SAAS;YACZ,MAAK;QACP,KAAK,UAAU;YACb,MAAK;QACP,KAAK,OAAO;YACV,MAAK;QACP,KAAK,YAAY;YACf,MAAK;QACP,KAAK,kBAAkB;YACrB,MAAK;QACP,KAAK,qBAAqB;YACxB,MAAK;QACP,KAAK,mBAAmB;YACtB,MAAK;QAEP;YACE,MAAK;KACR;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ export declare const game_wallet_idl: {
2
+ version: string;
3
+ name: string;
4
+ instructions: {
5
+ name: string;
6
+ accounts: {
7
+ name: string;
8
+ isMut: boolean;
9
+ isSigner: boolean;
10
+ }[];
11
+ args: {
12
+ name: string;
13
+ type: string;
14
+ }[];
15
+ }[];
16
+ accounts: {
17
+ name: string;
18
+ type: {
19
+ kind: string;
20
+ fields: ({
21
+ name: string;
22
+ type: string;
23
+ } | {
24
+ name: string;
25
+ type: {
26
+ defined: string;
27
+ };
28
+ })[];
29
+ };
30
+ }[];
31
+ types: {
32
+ name: string;
33
+ type: {
34
+ kind: string;
35
+ variants: {
36
+ name: string;
37
+ }[];
38
+ };
39
+ }[];
40
+ errors: {
41
+ code: number;
42
+ name: string;
43
+ msg: string;
44
+ }[];
45
+ };