From a18a3d9a152173ee8af6084e68e1ac2305245019 Mon Sep 17 00:00:00 2001 From: Jason Paulos Date: Tue, 22 Sep 2020 11:18:56 -0400 Subject: [PATCH] Remove class properties --- package-lock.json | 246 ---------------------------- package.json | 3 +- src/client/v2/algod/models/types.js | 203 ++++++++++++----------- 3 files changed, 105 insertions(+), 347 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3855fc2f9..e9f450b61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -118,228 +118,6 @@ "@babel/types": "^7.4.4" } }, - "@babel/helper-create-class-features-plugin": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.5.tgz", - "integrity": "sha512-0nkdeijB7VlZoLT3r/mY3bUkw3T8WG/hNw+FATs/6+pG2039IJWjTYL0VTISqsNHMUTEnwbVnc89WIJX9Qed0A==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-member-expression-to-functions": "^7.10.5", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-replace-supers": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.10.4" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/generator": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.0.tgz", - "integrity": "sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/helper-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", - "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", - "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz", - "integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", - "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz", - "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==", - "dev": true - }, - "@babel/helper-replace-supers": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz", - "integrity": "sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.10.4", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", - "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.2.tgz", - "integrity": "sha512-Vuj/+7vLo6l1Vi7uuO+1ngCDNeVmNbTngcJFKCR/oEtz8tKz0CJxZEGmPt9KcIloZhOZ3Zit6xbpXT2MDlS9Vw==", - "dev": true - }, - "@babel/template": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", - "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/traverse": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.0.tgz", - "integrity": "sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.11.0", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.11.0", - "@babel/types": "^7.11.0", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" - } - }, - "@babel/types": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", - "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - } - } - }, "@babel/helper-define-map": { "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz", @@ -490,12 +268,6 @@ "@babel/types": "^7.4.4" } }, - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, "@babel/helper-wrap-function": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz", @@ -575,24 +347,6 @@ "@babel/plugin-syntax-async-generators": "^7.2.0" } }, - "@babel/plugin-proposal-class-properties": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.4.tgz", - "integrity": "sha512-vhwkEROxzcHGNu2mzUC0OFFNXdZ4M23ib8aRRcJSsW8BZK9pQMD7QB7csl97NBbgGZO7ZyHUyKDnxzOaP4IrCg==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - }, - "dependencies": { - "@babel/helper-plugin-utils": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz", - "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==", - "dev": true - } - } - }, "@babel/plugin-proposal-dynamic-import": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz", diff --git a/package.json b/package.json index a64ad6ca8..bb09c28ad 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ }, "devDependencies": { "@babel/core": "^7.6.0", - "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/preset-env": "^7.6.0", "babel-core": "^6.26.3", "babel-minify": "^0.5.1", @@ -44,7 +43,7 @@ ], "scripts": { "test": "mocha -R spec tests/", - "build": "browserify --transform [babelify --plugins [ @babel/plugin-proposal-class-properties ] ] src/main.js -s algosdk | minify --simplify --mangle.keepClassName --deadcode.keepFnArgs --comments false --outFile dist/algosdk.min.js" + "build": "browserify src/main.js -s algosdk | minify --simplify --mangle.keepClassName --deadcode.keepFnArgs --comments false --outFile dist/algosdk.min.js" }, "author": "Algorand, llc", "license": "MIT" diff --git a/src/client/v2/algod/models/types.js b/src/client/v2/algod/models/types.js index 4fc699639..bd3c8ac92 100644 --- a/src/client/v2/algod/models/types.js +++ b/src/client/v2/algod/models/types.js @@ -5,16 +5,6 @@ const base = require("./base"); * run TEAL scripts and return debugging information. */ class DryrunRequest extends base.BaseModel { - attribute_map = { - "txns": "txns", - "accounts": "accounts", - "apps": "apps", - "protocolVersion": "protocol-version", - "round": "round", - "latestTimestamp": "latest-timestamp", - "sources": "sources" - } - /** * Creates a new DryrunRequest object. * @param txns {Array.} @@ -35,6 +25,16 @@ class DryrunRequest extends base.BaseModel { this.round = round; this.latestTimestamp = latestTimestamp; this.sources = sources; + + this.attribute_map = { + "txns": "txns", + "accounts": "accounts", + "apps": "apps", + "protocolVersion": "protocol-version", + "round": "round", + "latestTimestamp": "latest-timestamp", + "sources": "sources" + }; } } @@ -43,12 +43,6 @@ class DryrunRequest extends base.BaseModel { * compiled, and inserted into transactions or application state. */ class DryrunSource extends base.BaseModel { - attribute_map = { - "fieldName": "field-name", - "source": "source", - "txnIndex": "txn-index", - "appIndex": "app-index" - } /** * Creates a new DryrunSource object. * @param fieldName {String} FieldName is what kind of sources this is. If lsig then it goes into the transactions[this.TxnIndex].LogicSig. If approv or clearp it goes into the Approval Program or Clear State Program of application[this.AppIndex]. @@ -62,30 +56,30 @@ class DryrunSource extends base.BaseModel { this.source = source; this.txnIndex = txnIndex; this.appIndex = appIndex; + + this.attribute_map = { + "fieldName": "field-name", + "source": "source", + "txnIndex": "txn-index", + "appIndex": "app-index" + }; } } class Application extends base.BaseModel { - attribute_map = { - "id": "id", - "params": "params" - } constructor(id, params) { super(); this.id = id; this.params = params; + + this.attribute_map = { + "id": "id", + "params": "params" + }; } } class ApplicationParams extends base.BaseModel { - attribute_map = { - "creator": "creator", - "approvalProgram": "approval-program", - "clearStateProgram": "clear-state-program", - "localStateSchema": "local-state-schema", - "globalStateSchema": "global-state-schema", - "globalState": "global-state" - } constructor({ creator, approvalProgram, clearStateProgram, localStateSchema, globalStateSchema, globalState @@ -97,118 +91,114 @@ class ApplicationParams extends base.BaseModel { this.localStateSchema = localStateSchema; this.globalStateSchema = globalStateSchema; this.globalState = globalState; + + this.attribute_map = { + "creator": "creator", + "approvalProgram": "approval-program", + "clearStateProgram": "clear-state-program", + "localStateSchema": "local-state-schema", + "globalStateSchema": "global-state-schema", + "globalState": "global-state" + }; } } class ApplicationStateSchema extends base.BaseModel { - attribute_map = { - "numUint": "num-uint", - "numByteSlice": "num-byte-slice" - } constructor(numUint, numByteSlice) { super(); this.numUint = numUint; this.numByteSlice = numByteSlice; + + this.attribute_map = { + "numUint": "num-uint", + "numByteSlice": "num-byte-slice" + }; } } class ApplicationLocalStates extends base.BaseModel { - attribute_map = { - "id": "id", - "state": "state" - } - constructor(id, state) { super(); this.id = id; this.state = state; + + this.attribute_map = { + "id": "id", + "state": "state" + }; } } class ApplicationLocalState extends base.BaseModel { - attribute_map = { - "schema": "schema", - "keyValue": "key-value" - } - constructor(schema, keyValue) { super(); this.schema = schema; this.keyValue = keyValue; + + this.attribute_map = { + "schema": "schema", + "keyValue": "key-value" + }; } } class TealKeyValue extends base.BaseModel { - attribute_map = { - "key": "key", - "value": "value" - } constructor(key, value) { super(); this.key = key; this.value = value; + + this.attribute_map = { + "key": "key", + "value": "value" + }; } } class TealValue extends base.BaseModel { - attribute_map = { - "type": "type", - "bytes": "bytes", - "uint": "uint" - } constructor(type, bytes, uint) { super(); this.type = type; this.bytes = bytes; this.uint = uint; + + this.attribute_map = { + "type": "type", + "bytes": "bytes", + "uint": "uint" + }; } } class AssetHolding extends base.BaseModel { - attribute_map = { - "amount": "amount", - "assetId": "asset-id", - "creator": "creator", - "isFrozen": "is-frozen" - } - constructor(amount, assetId, creator, isFrozen) { this.amount = amount; this.assetId = assetId; this.creator = creator; this.isFrozen = isFrozen; + + this.attribute_map = { + "amount": "amount", + "assetId": "asset-id", + "creator": "creator", + "isFrozen": "is-frozen" + }; } } class Asset extends base.BaseModel { - attribute_map = { - "index": "index", - "params": "params" - - } - constructor(index, params) { this.amount = index; this.assetId = params; + + this.attribute_map = { + "index": "index", + "params": "params" + }; } } class AssetParams extends base.BaseModel { - attribute_map = { - "clawback": "clawback", - "creator": "creator", - "decimals": "decimals", - "defaultFrozen": "default-frozen", - "freeze": "freeze", - "manager": "manager", - "metadataHash": "metadata-hash", - "name": "name", - "reserve": "reserve", - "total": "total", - "unitName": "unit-name", - "url": "url" - } - constructor({ clawback, creator, decimals, defaultFrozen, freeze, manager, metadataHash, name, reserve, total, unitName, url @@ -225,29 +215,25 @@ class AssetParams extends base.BaseModel { this.total = total; this.unitName = unitName; this.url = url; + + this.attribute_map = { + "clawback": "clawback", + "creator": "creator", + "decimals": "decimals", + "defaultFrozen": "default-frozen", + "freeze": "freeze", + "manager": "manager", + "metadataHash": "metadata-hash", + "name": "name", + "reserve": "reserve", + "total": "total", + "unitName": "unit-name", + "url": "url" + }; } } class Account extends base.BaseModel { - attribute_map = { - "address": "address", - "amount": "amount", - "amountWithoutPendingRewards": "amount-without-pending-rewards", - "appsLocalState": "apps-local-state", - "appsTotalSchema": "apps-total-schema", - "assets": "assets", - "createdApps": "created-apps", - "createdAssets": "created-assets", - "participation": "participation", - "pendingRewards": "pending-rewards", - "rewardBase": "reward-base", - "rewards": "rewards", - "round": "round", - "status": "status", - "sigType": "sig-type", - "authAddr": "auth-addr" - } - constructor({ address, amount, amountWithoutPendingRewards, appsLocalState, appsTotalSchema, assets, createdApps, createdAssets, participation, @@ -271,6 +257,25 @@ class Account extends base.BaseModel { this.status = status; this.sigType = sigType; this.authAddr = authAddr; + + this.attribute_map = { + "address": "address", + "amount": "amount", + "amountWithoutPendingRewards": "amount-without-pending-rewards", + "appsLocalState": "apps-local-state", + "appsTotalSchema": "apps-total-schema", + "assets": "assets", + "createdApps": "created-apps", + "createdAssets": "created-assets", + "participation": "participation", + "pendingRewards": "pending-rewards", + "rewardBase": "reward-base", + "rewards": "rewards", + "round": "round", + "status": "status", + "sigType": "sig-type", + "authAddr": "auth-addr" + }; } } @@ -279,6 +284,6 @@ module.exports = { Account, Application, ApplicationParams, Asset, AssetParams, - AssetHolding, ApplicationLocalState, ApplicationStateSchema, + AssetHolding, ApplicationLocalStates, ApplicationLocalState, ApplicationStateSchema, TealKeyValue, TealValue, };