From 653dea0a9462a7e92de2b66c0a409371c2f1d0bb Mon Sep 17 00:00:00 2001 From: Aaron Cox Date: Tue, 7 Nov 2023 12:39:41 -0800 Subject: [PATCH] 3.x release (#37) * Starting migration to Wharfkit namespace and libs * Version 3.0.0-beta1 * Updating package name * Version 3.1.0-rc1 * Updating to @wharfkit/antelope 1.0.0 * Removing embedded ABIs in an unideal way until fixes are implemented * Version 3.1.0 --- package.json | 14 +++++------ src/abi.ts | 2 +- src/chain-id.ts | 2 +- src/identity-proof.ts | 2 +- src/signing-request.ts | 44 +++++++++++++++++++-------------- test/request.ts | 2 +- test/utils/mock-abi-provider.ts | 2 +- yarn.lock | 28 ++++++++++++--------- 8 files changed, 55 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 977c6a2..441326b 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "eosio-signing-request", - "version": "2.5.3", - "description": "EOSIO Signing Request (ESR / EEP-7) encoder and decoder", + "name": "@wharfkit/signing-request", + "version": "3.1.0", + "description": "Signing Request (ESR / EEP-7) encoder and decoder for Antelope blockchains", "homepage": "https://github.com/greymass/eosio-signing-request", "license": "MIT", - "main": "lib/esr.js", - "module": "lib/esr.m.js", - "types": "lib/esr.d.ts", + "main": "lib/signing-request.js", + "module": "lib/signing-request.m.js", + "types": "lib/signing-request.d.ts", "sideEffects": false, "files": [ "src/*", @@ -16,7 +16,7 @@ "prepare": "make" }, "dependencies": { - "@greymass/eosio": "^0.6.0", + "@wharfkit/antelope": "^1.0.0", "tslib": "^2.0.3" }, "devDependencies": { diff --git a/src/abi.ts b/src/abi.ts index 59d58bf..af3919d 100644 --- a/src/abi.ts +++ b/src/abi.ts @@ -11,7 +11,7 @@ import { TypeAlias, UInt8, Variant, -} from '@greymass/eosio' +} from '@wharfkit/antelope' import {ChainIdVariant} from './chain-id' diff --git a/src/chain-id.ts b/src/chain-id.ts index 7b43976..dcd3c8a 100644 --- a/src/chain-id.ts +++ b/src/chain-id.ts @@ -5,7 +5,7 @@ import { TypeAlias, UInt8, Variant, -} from '@greymass/eosio' +} from '@wharfkit/antelope' /** Chain ID aliases. */ export enum ChainName { diff --git a/src/identity-proof.ts b/src/identity-proof.ts index f572f26..6fec839 100644 --- a/src/identity-proof.ts +++ b/src/identity-proof.ts @@ -15,7 +15,7 @@ import { TimePointSec, TimePointType, Transaction, -} from '@greymass/eosio' +} from '@wharfkit/antelope' import {IdentityV3} from './abi' import {ChainId, ChainIdType} from './chain-id' diff --git a/src/signing-request.ts b/src/signing-request.ts index 65b85da..a4db488 100644 --- a/src/signing-request.ts +++ b/src/signing-request.ts @@ -33,7 +33,7 @@ import { UInt32Type, UInt8, VarUInt, -} from '@greymass/eosio' +} from '@wharfkit/antelope' import * as base64u from './base64u' import {ChainAlias, ChainId, ChainIdType, ChainIdVariant, ChainName} from './chain-id' @@ -936,14 +936,16 @@ export class SigningRequest { data = Serializer.encode({object: id}) authorization = [id.permission] } - return [ - Action.from({ - account: '', - name: 'identity', - authorization, - data, - }), - ] + const action = Action.from({ + account: '', + name: 'identity', + authorization, + data, + }) + // TODO: The way payloads are encoded is including the ABI, which isn't what we want + // This needs to be resolved in wharfkit/antelope, and then the delete call here should be removed + delete action.abi + return [action] } else { // eslint-disable-next-line prefer-const let {scope, permission} = req.value as IdentityV3 @@ -951,14 +953,16 @@ export class SigningRequest { permission = PlaceholderAuth } const data = Serializer.encode({object: {scope, permission}, type: IdentityV3}) - return [ - Action.from({ - account: '', - name: 'identity', - authorization: [permission], - data, - }), - ] + const action = Action.from({ + account: '', + name: 'identity', + authorization: [permission], + data, + }) + // TODO: The way payloads are encoded is including the ABI, which isn't what we want + // This needs to be resolved in wharfkit/antelope, and then the delete call here should be removed + delete action.abi + return [action] } } case 'transaction': @@ -1246,7 +1250,11 @@ function encodeAction(action: AnyAction, abis: Record): Action { if (!abi) { throw new Error(`Missing ABI for ${action.account}`) } - return Action.from(action, abi) + const data = Action.from(action, abi) + // TODO: The way payloads are encoded is including the ABI, which isn't what we want + // This needs to be resolved in wharfkit/antelope, and then the delete call here should be removed + delete data.abi + return data } function isIdentity(action: AnyAction) { diff --git a/test/request.ts b/test/request.ts index 6004213..6c3dde4 100644 --- a/test/request.ts +++ b/test/request.ts @@ -12,7 +12,7 @@ import { SigningRequestEncodingOptions, } from '../src' import * as TSModule from '../src' -import {Name, PrivateKey, Serializer, Signature, UInt64} from '@greymass/eosio' +import {Name, PrivateKey, Serializer, Signature, UInt64} from '@wharfkit/antelope' import {IdentityProof} from '../src/identity-proof' let {SigningRequest, PlaceholderAuth, PlaceholderName} = TSModule diff --git a/test/utils/mock-abi-provider.ts b/test/utils/mock-abi-provider.ts index b24a6b2..c215162 100644 --- a/test/utils/mock-abi-provider.ts +++ b/test/utils/mock-abi-provider.ts @@ -1,7 +1,7 @@ import {readdirSync as readdir, readFileSync as readfile} from 'fs' import {join as joinPath} from 'path' import {AbiProvider} from '../../src' -import {Name} from '@greymass/eosio' +import {Name} from '@wharfkit/antelope' // To add an ABI for testing run (in project root): // CONTRACT=eosio.token; cleos -u https://eos.greymass.com get abi $CONTRACT > test/abis/$CONTRACT.json diff --git a/yarn.lock b/yarn.lock index c419c53..6eb5997 100644 --- a/yarn.lock +++ b/yarn.lock @@ -212,17 +212,6 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@greymass/eosio@^0.6.0": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@greymass/eosio/-/eosio-0.6.1.tgz#2af601b6f38a37cb3c78b62d80fd293b80814f62" - integrity sha512-K9VmejZmXHczuLBdQzEQayzISEG/s1PQ9awNf3nMeiVOnmjC5jnw/qNatY1PDpVhXsu+FcW59EAoCEWpuKnrfA== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - elliptic "^6.5.4" - hash.js "^1.0.0" - tslib "^2.0.3" - "@humanwhocodes/config-array@^0.9.2": version "0.9.5" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.5.tgz#2cbaf9a89460da24b5ca6531b8bbfc23e1df50c7" @@ -459,6 +448,18 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== +"@wharfkit/antelope@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.0.tgz#c3057b70575991be5de3aea19e0c474614783c80" + integrity sha512-gwc6L3AzceN/menx9HCV22Ekd3it1wRruY6dIkyfCaV2UBGmfvIVJ3wPaDi4Ppj2k50b86ShSSHdd52jOFd+dg== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + elliptic "^6.5.4" + hash.js "^1.0.0" + pako "^2.1.0" + tslib "^2.0.3" + acorn-jsx@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -1750,6 +1751,11 @@ package-hash@^4.0.0: lodash.flattendeep "^4.4.0" release-zalgo "^1.0.0" +pako@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" + integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"