Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from greymass/eosio to wharfkit/antelope #43

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"crypto": false
},
"dependencies": {
"@greymass/eosio": "^0.6.0",
"@greymass/miniaes": "^1.0.0",
"eosio-signing-request": "^2.5.0",
"@wharfkit/antelope": "^1.0.7",
"@wharfkit/signing-request": "^3.2.0",
"fetch-ponyfill": "^7.1.0",
"isomorphic-ws": "^4.0.1",
"pako": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/index-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export {
ChainId,
ChainIdType,
ChainName,
} from 'eosio-signing-request'
} from '@wharfkit/signing-request'
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import {Link} from './index-module'
export default Link

// expose dependencies
export * from 'eosio-signing-request'
export * from '@greymass/eosio'
export * from '@wharfkit/signing-request'
export * from '@wharfkit/antelope'
2 changes: 1 addition & 1 deletion src/link-callback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {v4 as uuid} from 'uuid'
import {CallbackPayload} from 'eosio-signing-request'
import {CallbackPayload} from '@wharfkit/signing-request'
import WebSocket from 'isomorphic-ws'

import {fetch, logWarn} from './utils'
Expand Down
8 changes: 4 additions & 4 deletions src/link-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {APIClient} from '@greymass/eosio'
import type {ChainIdType} from 'eosio-signing-request'
import type {APIClient} from '@wharfkit/antelope'
import type {ChainIdType} from '@wharfkit/signing-request'

import type {LinkCallbackService} from './link-callback'
import type {LinkChain} from './link'
Expand All @@ -15,7 +15,7 @@ export interface LinkChainConfig {
*/
chainId: ChainIdType
/**
* URL to EOSIO node to communicate with (or a @greymass/eosio APIClient instance).
* URL to EOSIO node to communicate with (or a @wharfkit/antelope APIClient instance).
*/
nodeUrl: string | APIClient
}
Expand Down Expand Up @@ -51,7 +51,7 @@ export interface LinkOptions {
*/
chainId?: ChainIdType
/**
* URL to EOSIO node to communicate with or a `@greymass/eosio` APIClient instance.
* URL to EOSIO node to communicate with or a `@wharfkit/antelope` APIClient instance.
* @deprecated Use [[chains]] instead.
*/
client?: string | APIClient
Expand Down
4 changes: 2 additions & 2 deletions src/link-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
PublicKey,
PublicKeyType,
Serializer,
} from '@greymass/eosio'
} from '@wharfkit/antelope'

import {ChainId, ChainIdType, SigningRequest} from 'eosio-signing-request'
import {ChainId, ChainIdType, SigningRequest} from '@wharfkit/signing-request'

import {SessionError} from './errors'
import {Link, TransactArgs, TransactOptions, TransactResult} from './link'
Expand Down
4 changes: 2 additions & 2 deletions src/link-transport.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {Bytes} from '@greymass/eosio'
import type {SigningRequest} from 'eosio-signing-request'
import type {Bytes} from '@wharfkit/antelope'
import type {SigningRequest} from '@wharfkit/signing-request'

import type {TransactResult} from './link'
import type {LinkSession} from './link-session'
Expand Down
2 changes: 1 addition & 1 deletion src/link-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Bytes, Name, PublicKey, Struct, TimePointSec, UInt32, UInt64} from '@greymass/eosio'
import {Bytes, Name, PublicKey, Struct, TimePointSec, UInt32, UInt64} from '@wharfkit/antelope'

@Struct.type('sealed_message')
export class SealedMessage extends Struct {
Expand Down
4 changes: 2 additions & 2 deletions src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
Signature,
SignedTransaction,
Transaction,
} from '@greymass/eosio'
} from '@wharfkit/antelope'

import {
AbiProvider,
Expand All @@ -31,7 +31,7 @@ import {
ResolvedTransaction,
SigningRequest,
SigningRequestCreateArguments,
} from 'eosio-signing-request'
} from '@wharfkit/signing-request'

import {CancelError, IdentityError} from './errors'
import {LinkOptions} from './link-options'
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
PublicKey,
Serializer,
UInt64,
} from '@greymass/eosio'
import {CallbackPayload, SigningRequest} from 'eosio-signing-request'
} from '@wharfkit/antelope'
import {CallbackPayload, SigningRequest} from '@wharfkit/signing-request'

import {SealedMessage} from './link-types'

Expand Down
2 changes: 1 addition & 1 deletion test/aes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as assert from 'assert'
import 'mocha'

import {sealMessage} from '../src/utils'
import {PrivateKey, UInt64} from '@greymass/eosio'
import {PrivateKey, UInt64} from '@wharfkit/antelope'

suite('aes', function () {
test('seal message', function () {
Expand Down
19 changes: 12 additions & 7 deletions test/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import {strict as assert} from 'assert'
import 'mocha'

import {Link, LinkTransport} from '../src'
import {SigningRequest} from 'eosio-signing-request'
import {SigningRequest} from '@wharfkit/signing-request'
import {
API,
APIClient,
APIMethods,
APIProvider,
APIResponse,
PermissionLevel,
PrivateKey,
TimePointSec,
} from '@greymass/eosio'
} from '@wharfkit/antelope'
import {LinkCallback, LinkCallbackResponse, LinkCallbackService} from '../src/link-callback'
import {readFileSync} from 'fs'
import {join as pathJoin} from 'path'
Expand Down Expand Up @@ -95,20 +96,24 @@ class TestManager implements LinkTransport, APIProvider, LinkCallbackService, Li
}

// api
async call(path: string, params?: any): Promise<APIResponse> {
switch (path) {
async call(args: {
path: string
params?: any
method?: APIMethods | undefined
}): Promise<APIResponse> {
switch (args.path) {
case '/v1/chain/get_account':
return this.morph(this.account)
case '/v1/chain/get_abi': {
const account = String(params.account_name)
const account = String(args.params.account_name)
const data = readFileSync(pathJoin(__dirname, 'abis', `${account}.json`))
return this.morph({account_name: account, abi: JSON.parse(data.toString('utf-8'))})
}
case '/v1/chain/push_transaction': {
return this.morph({})
}
default:
throw new Error(`Unexpected request to ${path}`)
throw new Error(`Unexpected request to ${args.path}`)
}
}

Expand Down Expand Up @@ -159,7 +164,7 @@ const link = new Link({
],
transport: manager,
service: manager,
verifyProofs: true
verifyProofs: true,
})

suite('session', function () {
Expand Down
44 changes: 25 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -922,17 +922,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"

"@greymass/miniaes@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@greymass/miniaes/-/miniaes-1.0.0.tgz#2337a4637edbb49289f3c977c5891bb6bef1ba75"
Expand Down Expand Up @@ -1235,6 +1224,26 @@
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.7":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.7.tgz#5ca010db963e061b2e8c47c14e55f86817718c2e"
integrity sha512-C4DRC4U+qC2XQKUgwznKX6i8xdKo+ZqxkZURrPTtY3v53IvKwj+3amTQQSpuECechS5x6ItcT+/fOFBNlQ2Juw==
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"

"@wharfkit/signing-request@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@wharfkit/signing-request/-/signing-request-3.2.0.tgz#94cab97e27d1001973771056cfb9d54c02e45354"
integrity sha512-rIMzqwAKA5vb09+1BI+9fUXbj73JIkYcD1XT/Tom+k/+bqi51JcmC0trjCOjTUOK9UYDabpxYFixrf1ZvQymKw==
dependencies:
"@wharfkit/antelope" "^1.0.7"
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"
Expand Down Expand Up @@ -1718,14 +1727,6 @@ emoji-regex@^8.0.0:
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==

eosio-signing-request@^2.5.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/eosio-signing-request/-/eosio-signing-request-2.5.1.tgz#2d33e4e6aeb747ea80cb1357b11ef77d1e2f18e6"
integrity sha512-vA1jg118gSLJUmAs9FLDfrz+h2/sxt3lEKu19AO1lAzCgCB3Ib70VGfmFoLrty9Qzm1USTnn1EkogN780Ylq0Q==
dependencies:
"@greymass/eosio" "^0.6.0"
tslib "^2.0.3"

es6-error@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
Expand Down Expand Up @@ -2797,6 +2798,11 @@ pako@^2.0.3:
resolved "https://registry.yarnpkg.com/pako/-/pako-2.0.4.tgz#6cebc4bbb0b6c73b0d5b8d7e8476e2b2fbea576d"
integrity sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==

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"
Expand Down