@agoric/orchestration 0.1.1-dev-de52d49.0.de52d49 → 0.1.1-dev-eb52bc3.0.eb52bc3
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.
- package/package.json +17 -17
- package/src/utils/address.d.ts +3 -3
- package/src/utils/address.d.ts.map +1 -1
- package/src/utils/address.js +2 -18
- package/src/utils/eip712-messages.js +1 -1
- package/src/utils/evm-address.d.ts +4 -0
- package/src/utils/evm-address.d.ts.map +1 -0
- package/src/utils/evm-address.js +28 -0
- package/src/utils/permit2/signatureTransferHelpers.js +1 -1
- package/src/utils/viem-utils/eip712-normalize.d.ts.map +1 -1
- package/src/utils/viem-utils/eip712-normalize.js +2 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-eb52bc3.0.eb52bc3",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
39
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
40
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
41
|
-
"@agoric/internal": "0.3.3-dev-
|
|
42
|
-
"@agoric/network": "0.1.1-dev-
|
|
43
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
44
|
-
"@agoric/store": "0.9.3-dev-
|
|
45
|
-
"@agoric/time": "0.3.3-dev-
|
|
46
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
47
|
-
"@agoric/vow": "0.1.1-dev-
|
|
48
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
49
|
-
"@agoric/zone": "0.2.3-dev-
|
|
38
|
+
"@agoric/async-flow": "0.1.1-dev-eb52bc3.0.eb52bc3",
|
|
39
|
+
"@agoric/cosmic-proto": "0.4.1-dev-eb52bc3.0.eb52bc3",
|
|
40
|
+
"@agoric/ertp": "0.16.3-dev-eb52bc3.0.eb52bc3",
|
|
41
|
+
"@agoric/internal": "0.3.3-dev-eb52bc3.0.eb52bc3",
|
|
42
|
+
"@agoric/network": "0.1.1-dev-eb52bc3.0.eb52bc3",
|
|
43
|
+
"@agoric/notifier": "0.6.3-dev-eb52bc3.0.eb52bc3",
|
|
44
|
+
"@agoric/store": "0.9.3-dev-eb52bc3.0.eb52bc3",
|
|
45
|
+
"@agoric/time": "0.3.3-dev-eb52bc3.0.eb52bc3",
|
|
46
|
+
"@agoric/vat-data": "0.5.3-dev-eb52bc3.0.eb52bc3",
|
|
47
|
+
"@agoric/vow": "0.1.1-dev-eb52bc3.0.eb52bc3",
|
|
48
|
+
"@agoric/zoe": "0.26.3-dev-eb52bc3.0.eb52bc3",
|
|
49
|
+
"@agoric/zone": "0.2.3-dev-eb52bc3.0.eb52bc3",
|
|
50
50
|
"@cosmjs/encoding": "^0.36.0",
|
|
51
51
|
"@endo/base64": "^1.1.1",
|
|
52
52
|
"@endo/common": "^1.4.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"bs58": "^6.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
65
|
-
"@agoric/vats": "0.15.2-dev-
|
|
66
|
-
"@agoric/xsnap": "0.14.3-dev-
|
|
64
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-eb52bc3.0.eb52bc3",
|
|
65
|
+
"@agoric/vats": "0.15.2-dev-eb52bc3.0.eb52bc3",
|
|
66
|
+
"@agoric/xsnap": "0.14.3-dev-eb52bc3.0.eb52bc3",
|
|
67
67
|
"@chain-registry/client": "^1.53.194",
|
|
68
68
|
"@cosmjs/amino": "^0.36.0",
|
|
69
69
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"typeCoverage": {
|
|
101
101
|
"atLeast": 96.68
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "eb52bc371f1d95f517989c49cf30633ba50d9d41"
|
|
104
104
|
}
|
package/src/utils/address.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export const DEFAULT_ICQ_VERSION: "icq-1";
|
|
|
11
11
|
export function makeICQChannelAddress(controllerConnectionId: IBCConnectionID, version?: string): RemoteIbcAddress;
|
|
12
12
|
export function findAddressField(remoteAddressString: RemoteIbcAddress): CosmosChainAddress["value"] | undefined;
|
|
13
13
|
export function getBech32Prefix(address: Bech32Address | string): string;
|
|
14
|
-
export function sameEvmAddress(a: EvmAddress, b: EvmAddress | undefined): boolean;
|
|
15
|
-
export function isEvmAddressShape(x: unknown): x is EvmAddress;
|
|
16
14
|
export function coerceAccountId(idArg: AccountIdArg): AccountId;
|
|
17
15
|
export function parseAccountIdArg(idArg: AccountIdArg): Caip10Record;
|
|
18
16
|
export function parseAccountId(accountId: AccountId): Caip10Record;
|
|
@@ -44,9 +42,11 @@ import type { Bech32Address } from '../types.js';
|
|
|
44
42
|
import type { IBCConnectionID } from '@agoric/network/ibc';
|
|
45
43
|
import type { RemoteIbcAddress } from '@agoric/network/ibc';
|
|
46
44
|
import type { CosmosChainAddress } from '../types.js';
|
|
47
|
-
import
|
|
45
|
+
import { sameEvmAddress } from './evm-address.js';
|
|
46
|
+
import { isEvmAddressShape } from './evm-address.js';
|
|
48
47
|
import type { AccountIdArg } from '../orchestration-api.js';
|
|
49
48
|
import type { AccountId } from '../orchestration-api.js';
|
|
50
49
|
import type { Caip10Record } from '../orchestration-api.js';
|
|
51
50
|
import type { CaipChainId } from '../types.js';
|
|
51
|
+
export { sameEvmAddress, isEvmAddressShape };
|
|
52
52
|
//# sourceMappingURL=address.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"AA4NA;;;;;;GAMG;AACH,6CAHW,MAAM,GACJ,QAAQ,OAAO,IAAI,aAAa,CAM5C;AA1MM,wDALI,eAAe,0BACf,eAAe,6CACf,qBAAqB,GACnB,gBAAgB,CA4B5B;AAGD,kCAAmC,OAAO,CAAC;AAOpC,8DAJI,eAAe,YACf,MAAM,GACJ,gBAAgB,CAa5B;AAaM,sDAJI,gBAAgB,GAEd,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS,CAYnD;AAaM,yCAHI,aAAa,GAAG,MAAM,GACpB,MAAM,CAQlB;AAeM,uCAJI,YAAY,GAEV,SAAS,CAQrB;AAUM,yCAJI,YAAY,GAEV,YAAY,CAaxB;AASM,0CAHI,SAAS,GACP,YAAY,CAaxB;AAUM,6CAJI,YAAY,GAEV,WAAW,CAKvB;AASM,yCAJI,MAAM,GACJ,OAAO,CAkBnB;AAwBM,uDAFI,MAAM,+BAOhB;AAWM,8CAJI,SAAS,GACP,UAAU,CAatB;;;;;;;;;;;;;;;;;;;;;mCAlQgE,aAAa;qCAF1B,qBAAqB;sCAArB,qBAAqB;wCAER,aAAa;+BAL5B,kBAAkB;kCAAlB,kBAAkB;kCAMZ,yBAAyB;+BAAzB,yBAAyB;kCAAzB,yBAAyB;iCADhB,aAAa"}
|
package/src/utils/address.js
CHANGED
|
@@ -2,6 +2,7 @@ import { encodeRemoteIbcAddress } from '@agoric/network/ibc/utils.js';
|
|
|
2
2
|
import { fromBech32, fromHex } from '@cosmjs/encoding';
|
|
3
3
|
import { Fail, q } from '@endo/errors';
|
|
4
4
|
import bs58 from 'bs58';
|
|
5
|
+
import { isEvmAddressShape, sameEvmAddress } from './evm-address.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @import {IBCConnectionID, RemoteIbcAddress} from '@agoric/network/ibc';
|
|
@@ -117,25 +118,8 @@ export const getBech32Prefix = address => {
|
|
|
117
118
|
return address.slice(0, split);
|
|
118
119
|
};
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
* Compare two EVM addresses for equality, case-insensitive.
|
|
122
|
-
*
|
|
123
|
-
* @param {EvmAddress} a
|
|
124
|
-
* @param {EvmAddress | undefined} b
|
|
125
|
-
* @returns {boolean}
|
|
126
|
-
*/
|
|
127
|
-
export const sameEvmAddress = (a, b) => a.toLowerCase() === b?.toLowerCase();
|
|
121
|
+
export { sameEvmAddress, isEvmAddressShape };
|
|
128
122
|
harden(sameEvmAddress);
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Whether `x` has the shape of an EVM address: `0x` followed by 40 hex
|
|
132
|
-
* digits, in any casing (an EIP-55 checksum is not verified).
|
|
133
|
-
*
|
|
134
|
-
* @param {unknown} x
|
|
135
|
-
* @returns {x is EvmAddress}
|
|
136
|
-
*/
|
|
137
|
-
export const isEvmAddressShape = x =>
|
|
138
|
-
typeof x === 'string' && /^0x[0-9a-fA-F]{40}$/u.test(x);
|
|
139
123
|
harden(isEvmAddressShape);
|
|
140
124
|
|
|
141
125
|
/**
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
makeWitness,
|
|
36
36
|
PermitTransferFromTypeParams,
|
|
37
37
|
} from './permit2.js';
|
|
38
|
-
import { isEvmAddressShape, sameEvmAddress } from './address.js';
|
|
38
|
+
import { isEvmAddressShape, sameEvmAddress } from './evm-address.js';
|
|
39
39
|
import { normalizeAndValidateEIP712Data } from './viem-utils/eip712-normalize.js';
|
|
40
40
|
|
|
41
41
|
;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm-address.d.ts","sourceRoot":"","sources":["evm-address.js"],"names":[],"mappings":"AAiBO,kCAJI,UAAU,KACV,UAAU,GAAG,SAAS,GACpB,OAAO,CAEwD;AASrE,qCAHI,OAAO,GACL,CAAC,IAAI,UAAU,CAG6B;2CApBjB,MAAM"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file EVM address helpers with no runtime dependencies, so that modules
|
|
3
|
+
* meant to also run outside of a locked-down (SES) environment, such as the
|
|
4
|
+
* EIP-712 message helpers, can use them.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @import {Address as EvmAddress} from 'viem';
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Compare two EVM addresses for equality, case-insensitive.
|
|
13
|
+
*
|
|
14
|
+
* @param {EvmAddress} a
|
|
15
|
+
* @param {EvmAddress | undefined} b
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/
|
|
18
|
+
export const sameEvmAddress = (a, b) => a.toLowerCase() === b?.toLowerCase();
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Whether `x` has the shape of an EVM address: `0x` followed by 40 hex
|
|
22
|
+
* digits, in any casing (an EIP-55 checksum is not verified).
|
|
23
|
+
*
|
|
24
|
+
* @param {unknown} x
|
|
25
|
+
* @returns {x is EvmAddress}
|
|
26
|
+
*/
|
|
27
|
+
export const isEvmAddressShape = x =>
|
|
28
|
+
typeof x === 'string' && /^0x[0-9a-fA-F]{40}$/u.test(x);
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
permitWitnessTransferFromTypes,
|
|
28
28
|
TokenPermissionTypeParams,
|
|
29
29
|
} from './signatureTransfer.js';
|
|
30
|
-
import { isEvmAddressShape, sameEvmAddress } from '../address.js';
|
|
30
|
+
import { isEvmAddressShape, sameEvmAddress } from '../evm-address.js';
|
|
31
31
|
|
|
32
32
|
const PrimaryTypes = keyMirror({
|
|
33
33
|
PermitBatchWitnessTransferFrom: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eip712-normalize.d.ts","sourceRoot":"","sources":["eip712-normalize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;;;GA+BG;AACH,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,OAAO,OAAO,KACb,OAgFF,CAAC;AAwLF,eAAO,MAAM,8BAA8B,GACzC,OAAO,mCAAmC,EAC1C,UAAS,qCAA0C,KAClD,oCA+EF,CAAC"}
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
* than converted to the equivalent hex string.
|
|
66
66
|
*/
|
|
67
67
|
|
|
68
|
+
import { isEvmAddressShape } from '../evm-address.js';
|
|
68
69
|
import { describeValue, quoteName, quoteNameList } from '../meta.js';
|
|
69
70
|
|
|
70
71
|
;
|
|
@@ -108,11 +109,6 @@ const splitArrayType = (
|
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
111
|
|
|
111
|
-
// Same shape as `isEvmAddressShape` in `../address.js`, duplicated rather
|
|
112
|
-
// than imported: this module must have no runtime imports (see the module
|
|
113
|
-
// doc comment; `eip712-normalize.xs.test.js` also evaluates its source
|
|
114
|
-
// directly), and `address.js` has runtime dependencies of its own.
|
|
115
|
-
const ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/u;
|
|
116
112
|
// Solidity `(u)int<M>`: (un)signed integer of `M` bits, `0 < M <= 256`,
|
|
117
113
|
// `M % 8 === 0`. Unlike viem's `integerRegex` (utils/regex.ts), the width
|
|
118
114
|
// is required: EIP-712 has no bare `uint`/`int` aliases, and viem and
|
|
@@ -237,7 +233,7 @@ export const normalizeEIP712Primitive = (
|
|
|
237
233
|
const quotedType = quoteName(fieldType);
|
|
238
234
|
|
|
239
235
|
if (fieldType === 'address') {
|
|
240
|
-
if (
|
|
236
|
+
if (!isEvmAddressShape(value)) {
|
|
241
237
|
throw new Error(`Invalid EIP-712 address value: ${describeValue(value)}`);
|
|
242
238
|
}
|
|
243
239
|
return value;
|