@sentio/sdk 2.2.0-rc.3 → 2.3.0-rc.1

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.
@@ -60,7 +60,7 @@ export default class EthersSentio extends Ethers.default {
60
60
  indexContent =
61
61
  indexContent +
62
62
  `
63
- export * as ${contract.name.toLowerCase()} from './${contract.name.toLowerCase()}.js'
63
+ export * as ${contract.name.toLowerCase().replaceAll('-', '_')} from './${contract.name.toLowerCase()}.js'
64
64
  export { ${contract.name}Processor, ${contract.name}ProcessorTemplate } from './${contract.name.toLowerCase()}.js'
65
65
  `;
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ethers-sentio.js","sourceRoot":"","sources":["../../../src/eth/codegen/ethers-sentio.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAEL,UAAU,EACV,oBAAoB,EAEpB,KAAK,EACL,uBAAuB,GAExB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM,CAAC,OAAO;IACtD,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;SAC/C;QACD,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;IAEO,kBAAkB,GAAe,EAAE,CAAA;IAE3C,kEAAkE;IACzD,0BAA0B,CAAC,IAAqB;QACvD,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,OAAM;SACP;QAED,MAAM,aAAa,GAAG,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M,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;QAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE;YACzC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBACtC,IAAI,CAAC,QAAQ,GAAG,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAA;aACnD;iBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;gBACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;aACxE;iBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;aAC/C;SACF;QACD,IAAI,YAAY,GAAG,EAAE,CAAA;QACrB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC9C,YAAY;gBACV,YAAY;oBACZ;0BACkB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;uBACrE,QAAQ,CAAC,IAAI,cAC1B,QAAQ,CAAC,IACX,+BAA+B,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;aACrD,CAAA;SACR;QACD,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;YACjD,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["import Ethers from '@sentio/ethers-v6'\nimport {\n Config,\n extractAbi,\n extractDocumentation,\n FileDescription,\n parse,\n shortenFullJsonFilePath,\n Contract,\n} from 'typechain'\nimport { dirname, join, relative } from 'path'\nimport { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file.js'\n\nexport default class EthersSentio extends Ethers.default {\n constructor(config: Config) {\n if (!config.outDir) {\n throw new Error('Out put path not specificed')\n }\n super(config)\n }\n\n private processedContracts: Contract[] = []\n\n // TODO(pc): also have to override transformBinFile, transformFile\n override transformAbiOrFullJsonFile(file: FileDescription): FileDescription[] | void {\n const abi = extractAbi(file.contents)\n if (abi.length === 0) {\n return\n }\n\n const documentation = extractDocumentation(file.contents)\n\n const jsonPath = relative(this.cfg.inputDir, shortenFullJsonFilePath(file.path, this.cfg.allFiles))\n const contract = parse(abi, jsonPath, documentation)\n const files = super.transformAbiOrFullJsonFile(file)\n this.processedContracts.push(contract)\n\n if (files !== undefined) {\n // files.forEach(this.transformFilePath)\n // for (const file of files) {\n // this.transformFilePath(file)\n // }\n\n return [\n ...files,\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_processor.ts`),\n contents: codeGenSentioFile(contract),\n },\n {\n path: join(dirname(files[0].path), '..', `${contract.name.toLowerCase()}.ts`),\n contents: codeGenIndex(contract),\n },\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_test-utils.ts`),\n contents: codeGenTestUtilsFile(contract),\n },\n ]\n }\n }\n\n override afterRun() {\n const files = super.afterRun()\n for (const [idx, file] of files.entries()) {\n if (file.path.endsWith('__factory.ts')) {\n file.contents = '// @ts-nocheck\\n' + file.contents\n } else if (file.path.endsWith('factories/index.ts')) {\n file.contents = file.contents.replaceAll(\"__factory'\", \"__factory.js'\")\n } else if (file.path.endsWith('_processor.ts')) {\n }\n }\n let indexContent = ''\n for (const contract of this.processedContracts) {\n indexContent =\n indexContent +\n `\n export * as ${contract.name.toLowerCase()} from './${contract.name.toLowerCase()}.js'\n export { ${contract.name}Processor, ${\n contract.name\n }ProcessorTemplate } from './${contract.name.toLowerCase()}.js'\n `\n }\n files.push({\n path: join(dirname(files[0].path), '../index.ts'),\n contents: indexContent,\n })\n return files\n }\n}\n"]}
1
+ {"version":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AY,EAAE,eAAe,CAAC,CAAA;aACxE;iBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;aAC/C;SACF;QACD,IAAI,YAAY,GAAG,EAAE,CAAA;QACrB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC9C,YAAY;gBACV,YAAY;oBACZ;0BACkB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,YAAY,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;uBAC1F,QAAQ,CAAC,IAAI,cAC1B,QAAQ,CAAC,IACX,+BAA+B,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;aACrD,CAAA;SACR;QACD,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;YACjD,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["import Ethers from '@sentio/ethers-v6'\nimport {\n Config,\n extractAbi,\n extractDocumentation,\n FileDescription,\n parse,\n shortenFullJsonFilePath,\n Contract,\n} from 'typechain'\nimport { dirname, join, relative } from 'path'\nimport { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file.js'\n\nexport default class EthersSentio extends Ethers.default {\n constructor(config: Config) {\n if (!config.outDir) {\n throw new Error('Out put path not specificed')\n }\n super(config)\n }\n\n private processedContracts: Contract[] = []\n\n // TODO(pc): also have to override transformBinFile, transformFile\n override transformAbiOrFullJsonFile(file: FileDescription): FileDescription[] | void {\n const abi = extractAbi(file.contents)\n if (abi.length === 0) {\n return\n }\n\n const documentation = extractDocumentation(file.contents)\n\n const jsonPath = relative(this.cfg.inputDir, shortenFullJsonFilePath(file.path, this.cfg.allFiles))\n const contract = parse(abi, jsonPath, documentation)\n const files = super.transformAbiOrFullJsonFile(file)\n this.processedContracts.push(contract)\n\n if (files !== undefined) {\n // files.forEach(this.transformFilePath)\n // for (const file of files) {\n // this.transformFilePath(file)\n // }\n\n return [\n ...files,\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_processor.ts`),\n contents: codeGenSentioFile(contract),\n },\n {\n path: join(dirname(files[0].path), '..', `${contract.name.toLowerCase()}.ts`),\n contents: codeGenIndex(contract),\n },\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_test-utils.ts`),\n contents: codeGenTestUtilsFile(contract),\n },\n ]\n }\n }\n\n override afterRun() {\n const files = super.afterRun()\n for (const [idx, file] of files.entries()) {\n if (file.path.endsWith('__factory.ts')) {\n file.contents = '// @ts-nocheck\\n' + file.contents\n } else if (file.path.endsWith('factories/index.ts')) {\n file.contents = file.contents.replaceAll(\"__factory'\", \"__factory.js'\")\n } else if (file.path.endsWith('_processor.ts')) {\n }\n }\n let indexContent = ''\n for (const contract of this.processedContracts) {\n indexContent =\n indexContent +\n `\n export * as ${contract.name.toLowerCase().replaceAll('-', '_')} from './${contract.name.toLowerCase()}.js'\n export { ${contract.name}Processor, ${\n contract.name\n }ProcessorTemplate } from './${contract.name.toLowerCase()}.js'\n `\n }\n files.push({\n path: join(dirname(files[0].path), '../index.ts'),\n contents: indexContent,\n })\n return files\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "2.2.0-rc.3",
4
+ "version": "2.3.0-rc.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "compile": "tsc && cp src/utils/*.csv lib/utils && cp src/tsup.config.ts lib",
@@ -19,9 +19,9 @@
19
19
  "@project-serum/anchor": "^0.26.0",
20
20
  "@sentio/bigdecimal": "^9.1.1-patch.3",
21
21
  "@sentio/ethers-v6": "^1.0.25",
22
- "@sentio/protos": "^2.2.0-rc.3",
23
- "@sentio/runtime": "^2.2.0-rc.3",
24
- "@sentio/sdk": "^2.2.0-rc.3",
22
+ "@sentio/protos": "^2.3.0-rc.1",
23
+ "@sentio/runtime": "^2.3.0-rc.1",
24
+ "@sentio/sdk": "^2.3.0-rc.1",
25
25
  "@solana/web3.js": "^1.47.3",
26
26
  "@types/prettier": "^2.7.2",
27
27
  "aptos-sdk": "npm:@sentio/aptos@^1.6.0",
@@ -78,5 +78,5 @@
78
78
  "typedoc": {
79
79
  "entryPoint": "./src/index.ts"
80
80
  },
81
- "gitHead": "48b4487347d7be14ea1e7c8fb782cfc82e05ae3d"
81
+ "gitHead": "7a12d433f3bb8903652abe5398274bb788133e27"
82
82
  }
@@ -74,7 +74,7 @@ export default class EthersSentio extends Ethers.default {
74
74
  indexContent =
75
75
  indexContent +
76
76
  `
77
- export * as ${contract.name.toLowerCase()} from './${contract.name.toLowerCase()}.js'
77
+ export * as ${contract.name.toLowerCase().replaceAll('-', '_')} from './${contract.name.toLowerCase()}.js'
78
78
  export { ${contract.name}Processor, ${
79
79
  contract.name
80
80
  }ProcessorTemplate } from './${contract.name.toLowerCase()}.js'