diff --git a/.eslintrc.js b/.eslintrc.js index 1ad7098b9..f6ef1fe3c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,11 +1,11 @@ module.exports = { env: { - es6: true, + es6: true }, - extends: ["airbnb-base", "prettier"], - plugins: ["@babel", "prettier", "prefer-import"], - parser: "@babel/eslint-parser", + extends: ['airbnb-base', 'prettier'], + plugins: ['@babel', 'prettier', 'prefer-import'], + parser: '@babel/eslint-parser', rules: { - "node/no-unpublished-require": 0, - }, + 'node/no-unpublished-require': 0 + } }; diff --git a/.github/workflows/npm_publish.yml b/.github/workflows/npm_publish.yml index 31e6639dc..0a72ea4d1 100644 --- a/.github/workflows/npm_publish.yml +++ b/.github/workflows/npm_publish.yml @@ -19,9 +19,6 @@ jobs: - name: Install Depencencies run: yarn install - - name: Ensure minification for stable releases - run: cat package.json | jq '.version' | grep '.beta' || grep 'stellar-sdk.min.js' package.json - - name: Build, Test, and Package run: yarn preversion diff --git a/config/karma.conf.js b/config/karma.conf.js index cfe859572..bc54a9a87 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -1,4 +1,4 @@ -const webpackConfig = require("./webpack.config.browser.js"); +const webpackConfig = require('./webpack.config.browser.js'); delete webpackConfig.output; delete webpackConfig.entry; // karma fills these in @@ -6,33 +6,33 @@ webpackConfig.plugins.shift(); // drop eslinter plugin module.exports = function (config) { config.set({ - frameworks: ["mocha", "sinon-chai"], - browsers: ["FirefoxHeadless", "ChromeHeadless"], + frameworks: ['mocha', 'sinon-chai'], + browsers: ['FirefoxHeadless', 'ChromeHeadless'], files: [ - "../dist/stellar-sdk.js", // webpack should build this first - "../test/test-browser.js", - "../test/unit/**/*.js", + '../dist/stellar-sdk.js', // webpack should build this first + '../test/test-browser.js', + '../test/unit/**/*.js' ], preprocessors: { - "../test/**/*.js": ["webpack"], + '../test/**/*.js': ['webpack'] }, webpack: webpackConfig, webpackMiddleware: { - noInfo: true, + noInfo: true }, colors: true, singleRun: true, - reporters: ["dots", "coverage"], + reporters: ['dots', 'coverage'], coverageReporter: { - type: "text-summary", + type: 'text-summary', instrumenterOptions: { - istanbul: { noCompact: true }, - }, - }, + istanbul: { noCompact: true } + } + } }); }; diff --git a/config/prettier.config.js b/config/prettier.config.js index add7134df..40f1444de 100644 --- a/config/prettier.config.js +++ b/config/prettier.config.js @@ -1,13 +1,13 @@ module.exports = { - arrowParens: "always", + arrowParens: 'always', bracketSpacing: true, bracketSameLine: false, printWidth: 80, - proseWrap: "always", + proseWrap: 'always', semi: true, - singleQuote: false, + singleQuote: true, tabWidth: 2, - parser: "babel", - trailingComma: "all", - useTabs: false, + parser: 'babel', + trailingComma: 'none', + useTabs: false }; diff --git a/config/webpack.config.browser.js b/config/webpack.config.browser.js index 6f7a84731..bcb8f1c62 100644 --- a/config/webpack.config.browser.js +++ b/config/webpack.config.browser.js @@ -1,49 +1,49 @@ -var path = require("path"); -var webpack = require("webpack"); +var path = require('path'); +var webpack = require('webpack'); -var ESLintPlugin = require("eslint-webpack-plugin"); -var TerserPlugin = require("terser-webpack-plugin"); -var NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); +var ESLintPlugin = require('eslint-webpack-plugin'); +var TerserPlugin = require('terser-webpack-plugin'); +var NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); const config = { - target: "web", + target: 'web', // https://stackoverflow.com/a/34018909 entry: { - "stellar-sdk": path.resolve(__dirname, "../src/browser.ts"), - "stellar-sdk.min": path.resolve(__dirname, "../src/browser.ts"), + 'stellar-sdk': path.resolve(__dirname, '../src/browser.ts'), + 'stellar-sdk.min': path.resolve(__dirname, '../src/browser.ts') }, resolve: { fallback: { - crypto: require.resolve("crypto-browserify"), - stream: require.resolve("stream-browserify"), - buffer: require.resolve("buffer"), + crypto: require.resolve('crypto-browserify'), + stream: require.resolve('stream-browserify'), + buffer: require.resolve('buffer') }, - extensions: [".ts", ".js"], + extensions: ['.ts', '.js'] }, output: { clean: true, library: { - name: "StellarSdk", - type: "umd", - umdNamedDefine: true, + name: 'StellarSdk', + type: 'umd', + umdNamedDefine: true }, - path: path.resolve(__dirname, "../dist"), + path: path.resolve(__dirname, '../dist') }, - mode: process.env.NODE_ENV ?? "development", - devtool: process.env.NODE_ENV === "production" ? false : "inline-source-map", + mode: process.env.NODE_ENV ?? 'development', + devtool: process.env.NODE_ENV === 'production' ? false : 'inline-source-map', module: { rules: [ { test: /\.m?(ts|js)$/, exclude: /node_modules\/(?!(stellar-base|js-xdr))/, use: { - loader: "babel-loader", + loader: 'babel-loader', options: { - cacheDirectory: true, - }, - }, - }, - ], + cacheDirectory: true + } + } + } + ] }, optimization: { minimize: true, @@ -52,29 +52,29 @@ const config = { include: /\.min\.js$/, terserOptions: { format: { - ascii_only: true, - }, - }, - }), - ], + ascii_only: true + } + } + }) + ] }, plugins: [ // this must be first for karma to work (see line 5 of karma.conf.js) new ESLintPlugin({ - overrideConfigFile: path.resolve(__dirname, "../.eslintrc.js"), + overrideConfigFile: path.resolve(__dirname, '../.eslintrc.js') }), // Ignore native modules (sodium-native) new webpack.IgnorePlugin({ resourceRegExp: /sodium-native/ }), new NodePolyfillPlugin({ - includeAliases: ["http", "https"], // others aren't needed + includeAliases: ['http', 'https'] // others aren't needed }), new webpack.ProvidePlugin({ - Buffer: ["buffer", "Buffer"], - }), + Buffer: ['buffer', 'Buffer'] + }) ], watchOptions: { - ignored: /(node_modules|coverage|lib|dist)/, - }, + ignored: /(node_modules|coverage|lib|dist)/ + } }; module.exports = config; diff --git a/package.json b/package.json index c14ce62de..708ae2559 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stellar-sdk", - "version": "11.0.0-beta.4", + "version": "11.0.0-beta.3", "description": "A library for working with the Stellar Horizon server.", "keywords": [ "stellar" @@ -17,7 +17,7 @@ "author": "Stellar Development Foundation ", "main": "./lib/index.js", "types": "./lib/index.d.ts", - "browser": "./dist/stellar-sdk.min.js", + "browser": "./dist/stellar-sdk.js", "files": [ "/types", "/lib", @@ -43,7 +43,7 @@ "_build": "yarn build:node && yarn build:test && yarn build:browser", "_babel": "babel --extensions '.ts' --out-dir lib/ src/", "_nyc": "nyc --nycrc-path config/.nycrc", - "_prettier": "prettier --config config/prettier.config.js --ignore-path config/.prettierignore --write './**/*.js'" + "_prettier": "prettier --ignore-path config/.prettierignore --write './test/**/*.js'" }, "husky": { "hooks": { diff --git a/src/.eslintrc.js b/src/.eslintrc.js index 7ceb3272d..128adddd7 100644 --- a/src/.eslintrc.js +++ b/src/.eslintrc.js @@ -1,39 +1,39 @@ module.exports = { env: { - es6: true, + es6: true }, rules: { // OFF - "import/prefer-default-export": 0, - "node/no-unsupported-features/es-syntax": 0, - "node/no-unsupported-features/es-builtins": 0, + 'import/prefer-default-export': 0, + 'node/no-unsupported-features/es-syntax': 0, + 'node/no-unsupported-features/es-builtins': 0, camelcase: 0, - "class-methods-use-this": 0, - "linebreak-style": 0, - "new-cap": 0, - "no-param-reassign": 0, - "no-underscore-dangle": 0, - "no-use-before-define": 0, - "prefer-destructuring": 0, - "lines-between-class-members": 0, + 'class-methods-use-this': 0, + 'linebreak-style': 0, + 'new-cap': 0, + 'no-param-reassign': 0, + 'no-underscore-dangle': 0, + 'no-use-before-define': 0, + 'prefer-destructuring': 0, + 'lines-between-class-members': 0, // WARN - "prefer-import/prefer-import-over-require": [1], - "no-console": ["warn", { allow: ["assert"] }], - "no-debugger": 1, - "no-unused-vars": 1, - "arrow-body-style": 1, - "valid-jsdoc": [ + 'prefer-import/prefer-import-over-require': [1], + 'no-console': ['warn', { allow: ['assert'] }], + 'no-debugger': 1, + 'no-unused-vars': 1, + 'arrow-body-style': 1, + 'valid-jsdoc': [ 1, { - requireReturnDescription: false, - }, + requireReturnDescription: false + } ], - "prefer-const": 1, - "object-shorthand": 1, - "require-await": 1, + 'prefer-const': 1, + 'object-shorthand': 1, + 'require-await': 1, // ERROR - "no-unused-expressions": [2, { allowTaggedTemplates: true }], - }, + 'no-unused-expressions': [2, { allowTaggedTemplates: true }] + } }; diff --git a/src/browser.ts b/src/browser.ts index bbd6932ff..03027026b 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -1,9 +1,9 @@ /* tslint:disable:no-var-requires */ -export * from './index'; -export * as StellarBase from 'stellar-base'; +export * from "./index"; +export * as StellarBase from "stellar-base"; -import axios from 'axios'; // idk why axios is weird +import axios from "axios"; // idk why axios is weird export { axios }; export default module.exports; diff --git a/src/soroban/.eslintrc.js b/src/soroban/.eslintrc.js index 2dff00d7b..9d226df13 100644 --- a/src/soroban/.eslintrc.js +++ b/src/soroban/.eslintrc.js @@ -1,42 +1,42 @@ module.exports = { env: { - es6: true, + es6: true }, - parser: "@babel/eslint-parser", - extends: ["airbnb-base", "prettier"], - plugins: ["prettier", "prefer-import"], + parser: '@babel/eslint-parser', + extends: ['airbnb-base', 'prettier'], + plugins: ['prettier', 'prefer-import'], rules: { // OFF - "import/prefer-default-export": 0, - "node/no-unsupported-features/es-syntax": 0, - "node/no-unsupported-features/es-builtins": 0, + 'import/prefer-default-export': 0, + 'node/no-unsupported-features/es-syntax': 0, + 'node/no-unsupported-features/es-builtins': 0, camelcase: 0, - "class-methods-use-this": 0, - "linebreak-style": 0, - "new-cap": 0, - "no-param-reassign": 0, - "no-underscore-dangle": 0, - "no-use-before-define": 0, - "prefer-destructuring": 0, - "lines-between-class-members": 0, + 'class-methods-use-this': 0, + 'linebreak-style': 0, + 'new-cap': 0, + 'no-param-reassign': 0, + 'no-underscore-dangle': 0, + 'no-use-before-define': 0, + 'prefer-destructuring': 0, + 'lines-between-class-members': 0, // WARN - "prefer-import/prefer-import-over-require": [1], - "no-console": ["warn", { allow: ["assert"] }], - "no-debugger": 1, - "no-unused-vars": 1, - "arrow-body-style": 1, - "valid-jsdoc": [ + 'prefer-import/prefer-import-over-require': [1], + 'no-console': ['warn', { allow: ['assert'] }], + 'no-debugger': 1, + 'no-unused-vars': 1, + 'arrow-body-style': 1, + 'valid-jsdoc': [ 1, { - requireReturnDescription: false, - }, + requireReturnDescription: false + } ], - "prefer-const": 1, - "object-shorthand": 1, - "require-await": 1, + 'prefer-const': 1, + 'object-shorthand': 1, + 'require-await': 1, // ERROR - "no-unused-expressions": [2, { allowTaggedTemplates: true }], - }, + 'no-unused-expressions': [2, { allowTaggedTemplates: true }] + } }; diff --git a/test/unit/contract_spec.js b/test/unit/contract_spec.js index cf0d5f453..a106c0e2d 100644 --- a/test/unit/contract_spec.js +++ b/test/unit/contract_spec.js @@ -6,239 +6,251 @@ const publicKey = "GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW"; const addr = Address.fromString(publicKey); let SPEC; before(() => { - SPEC = new ContractSpec(spec); + SPEC = new ContractSpec(spec); }); it("throws if no entries", () => { - expect(() => new ContractSpec([])).to.throw(/Contract spec must have at least one entry/i); + expect(() => new ContractSpec([])).to.throw( + /Contract spec must have at least one entry/i, + ); }); describe("Can round trip custom types", function () { - function getResultType(funcName) { - let fn = SPEC.findEntry(funcName).value(); - if (!(fn instanceof xdr.ScSpecFunctionV0)) { - throw new Error("Not a function"); - } - if (fn.outputs().length === 0) { - return xdr.ScSpecTypeDef.scSpecTypeVoid(); - } - return fn.outputs()[0]; + function getResultType(funcName) { + let fn = SPEC.findEntry(funcName).value(); + if (!(fn instanceof xdr.ScSpecFunctionV0)) { + throw new Error("Not a function"); } - function roundtrip(funcName, input, typeName) { - let type = getResultType(funcName); - let ty = typeName ?? funcName; - let obj = {}; - obj[ty] = input; - let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; - let result = SPEC.scValToNative(scVal, type); - expect(result).deep.equal(input); + if (fn.outputs().length === 0) { + return xdr.ScSpecTypeDef.scSpecTypeVoid(); } - it("u32", () => { - roundtrip("u32_", 1); + return fn.outputs()[0]; + } + function roundtrip(funcName, input, typeName) { + let type = getResultType(funcName); + let ty = typeName ?? funcName; + let obj = {}; + obj[ty] = input; + let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; + let result = SPEC.scValToNative(scVal, type); + expect(result).deep.equal(input); + } + it("u32", () => { + roundtrip("u32_", 1); + }); + it("i32", () => { + roundtrip("i32_", -1); + }); + it("i64", () => { + roundtrip("i64_", 1n); + }); + it("strukt", () => { + roundtrip("strukt", { a: 0, b: true, c: "hello" }); + }); + describe("simple", () => { + it("first", () => { + const simple = { tag: "First", values: undefined }; + roundtrip("simple", simple); }); - it("i32", () => { - roundtrip("i32_", -1); + it("simple second", () => { + const simple = { tag: "Second", values: undefined }; + roundtrip("simple", simple); }); - it("i64", () => { - roundtrip("i64_", 1n); + it("simple third", () => { + const simple = { tag: "Third", values: undefined }; + roundtrip("simple", simple); }); - it("strukt", () => { - roundtrip("strukt", { a: 0, b: true, c: "hello" }); - }); - describe("simple", () => { - it("first", () => { - const simple = { tag: "First", values: undefined }; - roundtrip("simple", simple); - }); - it("simple second", () => { - const simple = { tag: "Second", values: undefined }; - roundtrip("simple", simple); - }); - it("simple third", () => { - const simple = { tag: "Third", values: undefined }; - roundtrip("simple", simple); - }); - }); - describe("complex", () => { - it("struct", () => { - const complex = { - tag: "Struct", - values: [{ a: 0, b: true, c: "hello" }], - }; - roundtrip("complex", complex); - }); - it("tuple", () => { - const complex = { - tag: "Tuple", - values: [ - [ - { a: 0, b: true, c: "hello" }, - { tag: "First", values: undefined }, - ], - ], - }; - roundtrip("complex", complex); - }); - it("enum", () => { - const complex = { - tag: "Enum", - values: [{ tag: "First", values: undefined }], - }; - roundtrip("complex", complex); - }); - it("asset", () => { - const complex = { tag: "Asset", values: [addr, 1n] }; - roundtrip("complex", complex); - }); - it("void", () => { - const complex = { tag: "Void", values: undefined }; - roundtrip("complex", complex); - }); - }); - it("addresse", () => { - roundtrip("addresse", addr); - }); - it("bytes", () => { - const bytes = Buffer.from("hello"); - roundtrip("bytes", bytes); - }); - it("bytes_n", () => { - const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? - roundtrip("bytes_n", bytes_n); - }); - it("card", () => { - const card = 11; - roundtrip("card", card); - }); - it("boolean", () => { - roundtrip("boolean", true); - }); - it("not", () => { - roundtrip("boolean", false); - }); - it("i128", () => { - roundtrip("i128", -1n); - }); - it("u128", () => { - roundtrip("u128", 1n); - }); - it("map", () => { - const map = new Map(); - map.set(1, true); - map.set(2, false); - roundtrip("map", map); - map.set(3, "hahaha"); - expect(() => roundtrip("map", map)).to.throw(/invalid type scSpecTypeBool specified for string value/i); - }); - it("vec", () => { - const vec = [1, 2, 3]; - roundtrip("vec", vec); + }); + describe("complex", () => { + it("struct", () => { + const complex = { + tag: "Struct", + values: [{ a: 0, b: true, c: "hello" }], + }; + roundtrip("complex", complex); }); it("tuple", () => { - const tuple = ["hello", 1]; - roundtrip("tuple", tuple); - }); - it("option", () => { - roundtrip("option", 1); - roundtrip("option", undefined); - }); - it("u256", () => { - roundtrip("u256", 1n); - expect(() => roundtrip("u256", -1n)).to.throw(/expected a positive value, got: -1/i); + const complex = { + tag: "Tuple", + values: [ + [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ], + ], + }; + roundtrip("complex", complex); }); - it("i256", () => { - roundtrip("i256", -1n); + it("enum", () => { + const complex = { + tag: "Enum", + values: [{ tag: "First", values: undefined }], + }; + roundtrip("complex", complex); }); - it("string", () => { - roundtrip("string", "hello"); + it("asset", () => { + const complex = { tag: "Asset", values: [addr, 1n] }; + roundtrip("complex", complex); }); - it("tuple_strukt", () => { - const arg = [ - { a: 0, b: true, c: "hello" }, - { tag: "First", values: undefined }, - ]; - roundtrip("tuple_strukt", arg); + it("void", () => { + const complex = { tag: "Void", values: undefined }; + roundtrip("complex", complex); }); + }); + it("addresse", () => { + roundtrip("addresse", addr); + }); + it("bytes", () => { + const bytes = Buffer.from("hello"); + roundtrip("bytes", bytes); + }); + it("bytes_n", () => { + const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? + roundtrip("bytes_n", bytes_n); + }); + it("card", () => { + const card = 11; + roundtrip("card", card); + }); + it("boolean", () => { + roundtrip("boolean", true); + }); + it("not", () => { + roundtrip("boolean", false); + }); + it("i128", () => { + roundtrip("i128", -1n); + }); + it("u128", () => { + roundtrip("u128", 1n); + }); + it("map", () => { + const map = new Map(); + map.set(1, true); + map.set(2, false); + roundtrip("map", map); + map.set(3, "hahaha"); + expect(() => roundtrip("map", map)).to.throw( + /invalid type scSpecTypeBool specified for string value/i, + ); + }); + it("vec", () => { + const vec = [1, 2, 3]; + roundtrip("vec", vec); + }); + it("tuple", () => { + const tuple = ["hello", 1]; + roundtrip("tuple", tuple); + }); + it("option", () => { + roundtrip("option", 1); + roundtrip("option", undefined); + }); + it("u256", () => { + roundtrip("u256", 1n); + expect(() => roundtrip("u256", -1n)).to.throw( + /expected a positive value, got: -1/i, + ); + }); + it("i256", () => { + roundtrip("i256", -1n); + }); + it("string", () => { + roundtrip("string", "hello"); + }); + it("tuple_strukt", () => { + const arg = [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ]; + roundtrip("tuple_strukt", arg); + }); }); describe("parsing and building ScVals", function () { - it("Can parse entries", function () { - let spec = new ContractSpec([GIGA_MAP, func]); - let fn = spec.findEntry("giga_map"); - let gigaMap = spec.findEntry("GigaMap"); - expect(gigaMap).deep.equal(GIGA_MAP); - expect(fn).deep.equal(func); - }); + it("Can parse entries", function () { + let spec = new ContractSpec([GIGA_MAP, func]); + let fn = spec.findEntry("giga_map"); + let gigaMap = spec.findEntry("GigaMap"); + expect(gigaMap).deep.equal(GIGA_MAP); + expect(fn).deep.equal(func); + }); }); -export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0(new xdr.ScSpecUdtStructV0({ +export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0( + new xdr.ScSpecUdtStructV0({ doc: "This is a kitchen sink of all the types", lib: "", name: "GigaMap", fields: [ - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "bool", - type: xdr.ScSpecTypeDef.scSpecTypeBool(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i128", - type: xdr.ScSpecTypeDef.scSpecTypeI128(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u128", - type: xdr.ScSpecTypeDef.scSpecTypeU128(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i256", - type: xdr.ScSpecTypeDef.scSpecTypeI256(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u256", - type: xdr.ScSpecTypeDef.scSpecTypeU256(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i32", - type: xdr.ScSpecTypeDef.scSpecTypeI32(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u32", - type: xdr.ScSpecTypeDef.scSpecTypeU32(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i64", - type: xdr.ScSpecTypeDef.scSpecTypeI64(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u64", - type: xdr.ScSpecTypeDef.scSpecTypeU64(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "symbol", - type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "string", - type: xdr.ScSpecTypeDef.scSpecTypeString(), - }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "bool", + type: xdr.ScSpecTypeDef.scSpecTypeBool(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i128", + type: xdr.ScSpecTypeDef.scSpecTypeI128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u128", + type: xdr.ScSpecTypeDef.scSpecTypeU128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i256", + type: xdr.ScSpecTypeDef.scSpecTypeI256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u256", + type: xdr.ScSpecTypeDef.scSpecTypeU256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i32", + type: xdr.ScSpecTypeDef.scSpecTypeI32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u32", + type: xdr.ScSpecTypeDef.scSpecTypeU32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i64", + type: xdr.ScSpecTypeDef.scSpecTypeI64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u64", + type: xdr.ScSpecTypeDef.scSpecTypeU64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "symbol", + type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "string", + type: xdr.ScSpecTypeDef.scSpecTypeString(), + }), ], -})); -const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt(new xdr.ScSpecTypeUdt({ name: "GigaMap" })); -let func = xdr.ScSpecEntry.scSpecEntryFunctionV0(new xdr.ScSpecFunctionV0({ + }), +); +const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt( + new xdr.ScSpecTypeUdt({ name: "GigaMap" }), +); +let func = xdr.ScSpecEntry.scSpecEntryFunctionV0( + new xdr.ScSpecFunctionV0({ doc: "Kitchen Sink", name: "giga_map", inputs: [ - new xdr.ScSpecFunctionInputV0({ - doc: "", - name: "giga_map", - type: GIGA_MAP_TYPE, - }), + new xdr.ScSpecFunctionInputV0({ + doc: "", + name: "giga_map", + type: GIGA_MAP_TYPE, + }), ], outputs: [GIGA_MAP_TYPE], -})); + }), +);