@agoric/orchestration 0.1.1-dev-33a5708.0 → 0.1.1-dev-db6d589.0
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 -16
- package/src/cosmos-api.d.ts +11 -1
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +15 -0
- package/src/examples/send-anywhere.contract.d.ts +3 -3
- package/src/examples/send-anywhere.contract.d.ts.map +1 -1
- package/src/examples/send-anywhere.contract.js +40 -13
- package/src/examples/send-anywhere.flows.d.ts +559 -2
- package/src/examples/send-anywhere.flows.d.ts.map +1 -1
- package/src/examples/send-anywhere.flows.js +105 -28
- package/src/examples/stake-ica.contract.d.ts +1 -0
- package/src/examples/stake-ica.contract.d.ts.map +1 -1
- package/src/exos/README.md +1 -0
- package/src/exos/chain-hub-admin.d.ts +2 -2
- package/src/exos/chain-hub-admin.d.ts.map +1 -1
- package/src/exos/chain-hub-admin.js +5 -7
- package/src/exos/chain-hub.d.ts +19 -8
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +75 -17
- package/src/exos/cosmos-orchestration-account.d.ts +2 -0
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +67 -2
- package/src/exos/orchestrator.d.ts +1 -1
- package/src/exos/remote-chain-facade.d.ts +1 -1
- package/src/orchestration-api.d.ts +4 -4
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.ts +6 -3
- package/src/proposals/start-send-anywhere.js +4 -0
- package/src/utils/address.d.ts +4 -1
- package/src/utils/address.d.ts.map +1 -1
- package/src/utils/address.js +32 -2
- package/src/utils/chain-info.d.ts +4 -0
- package/src/utils/chain-info.d.ts.map +1 -0
- package/src/utils/chain-info.js +11 -0
- package/src/utils/start-helper.d.ts +2 -1
- package/src/utils/start-helper.d.ts.map +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/** @file Use-object for the owner of a staking account */
|
|
2
2
|
import { toRequestQueryJson } from '@agoric/cosmic-proto';
|
|
3
|
+
import {
|
|
4
|
+
MsgDepositForBurn,
|
|
5
|
+
MsgDepositForBurnWithCaller,
|
|
6
|
+
} from '@agoric/cosmic-proto/circle/cctp/v1/tx.js';
|
|
3
7
|
import {
|
|
4
8
|
QueryAllBalancesRequest,
|
|
5
9
|
QueryAllBalancesResponse,
|
|
@@ -64,10 +68,11 @@ import {
|
|
|
64
68
|
} from '../utils/cosmos.js';
|
|
65
69
|
import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
66
70
|
import { makeTimestampHelper } from '../utils/time.js';
|
|
71
|
+
import { accountIdTo32Bytes, parseAccountId } from '../utils/address.js';
|
|
67
72
|
|
|
68
73
|
/**
|
|
69
74
|
* @import {HostOf} from '@agoric/async-flow';
|
|
70
|
-
* @import {AmountArg, IcaAccount, CosmosChainAddress, CosmosValidatorAddress, ICQConnection, StakingAccountActions, StakingAccountQueries, OrchestrationAccountCommon, CosmosRewardsResponse, IBCConnectionInfo, IBCMsgTransferOptions, ChainHub, CosmosDelegationResponse} from '../types.js';
|
|
75
|
+
* @import {AmountArg, IcaAccount, CosmosChainAddress, CosmosValidatorAddress, ICQConnection, StakingAccountActions, StakingAccountQueries, NobleMethods, OrchestrationAccountCommon, CosmosRewardsResponse, IBCConnectionInfo, IBCMsgTransferOptions, ChainHub, CosmosDelegationResponse, CaipChainId} from '../types.js';
|
|
71
76
|
* @import {ContractMeta, Invitation, OfferHandler, ZCF, ZCFSeat} from '@agoric/zoe';
|
|
72
77
|
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
73
78
|
* @import {Coin} from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
|
|
@@ -139,8 +144,16 @@ const stakingAccountQueriesMethods = {
|
|
|
139
144
|
getRewards: M.call().returns(VowShape),
|
|
140
145
|
};
|
|
141
146
|
|
|
147
|
+
/** @see {NobleMethods} */
|
|
148
|
+
const nobleMethods = {
|
|
149
|
+
depositForBurn: M.call(M.string(), AmountArgShape)
|
|
150
|
+
.optional(M.string())
|
|
151
|
+
.returns(VowShape),
|
|
152
|
+
};
|
|
153
|
+
|
|
142
154
|
/** @see {OrchestrationAccountCommon} */
|
|
143
155
|
export const IcaAccountHolderI = M.interface('IcaAccountHolder', {
|
|
156
|
+
...nobleMethods,
|
|
144
157
|
...orchestrationAccountMethods,
|
|
145
158
|
...stakingAccountActionsMethods,
|
|
146
159
|
...stakingAccountQueriesMethods,
|
|
@@ -208,7 +221,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
208
221
|
amountToCoin: M.call(AmountArgShape).returns(M.record()),
|
|
209
222
|
}),
|
|
210
223
|
returnVoidWatcher: M.interface('returnVoidWatcher', {
|
|
211
|
-
onFulfilled: M.call(M.
|
|
224
|
+
onFulfilled: M.call(M.any())
|
|
212
225
|
.optional(M.arrayOf(M.undefined()))
|
|
213
226
|
.returns(M.undefined()),
|
|
214
227
|
}),
|
|
@@ -1128,6 +1141,58 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
1128
1141
|
watch(E(this.facets.helper.owned()).executeEncodedTx(msgs, opts)),
|
|
1129
1142
|
);
|
|
1130
1143
|
},
|
|
1144
|
+
/**
|
|
1145
|
+
* @type {HostOf<NobleMethods['depositForBurn']>}
|
|
1146
|
+
*/
|
|
1147
|
+
depositForBurn(destination, amount, caller) {
|
|
1148
|
+
return asVow(() => {
|
|
1149
|
+
trace('depositForBurn', { destination, amount });
|
|
1150
|
+
const { helper } = this.facets;
|
|
1151
|
+
const { chainAddress } = this.state;
|
|
1152
|
+
|
|
1153
|
+
const destParts = parseAccountId(destination);
|
|
1154
|
+
/** @type {CaipChainId} */
|
|
1155
|
+
const chainId = `${destParts.namespace}:${destParts.reference}`;
|
|
1156
|
+
|
|
1157
|
+
const { cctpDestinationDomain } =
|
|
1158
|
+
chainHub.getChainInfoByChainId(chainId);
|
|
1159
|
+
if (typeof cctpDestinationDomain !== 'number') {
|
|
1160
|
+
throw Fail`${q(chainId)} does not have "cctpDestinationDomain" set in ChainInfo`;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/** @satisfies {MsgDepositForBurn} */
|
|
1164
|
+
const depositForBurn = {
|
|
1165
|
+
amount: helper.amountToCoin(amount)?.amount,
|
|
1166
|
+
from: chainAddress.value,
|
|
1167
|
+
destinationDomain: cctpDestinationDomain,
|
|
1168
|
+
mintRecipient: accountIdTo32Bytes(destination),
|
|
1169
|
+
// safe to hardcode since `uusdc` is the only asset supported by CCTP
|
|
1170
|
+
burnToken: 'uusdc',
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
const destinationCaller = (() => {
|
|
1174
|
+
if (!caller) return undefined;
|
|
1175
|
+
const callerParts = parseAccountId(caller);
|
|
1176
|
+
callerParts.namespace === destParts.namespace ||
|
|
1177
|
+
Fail`caller ${q(caller)} must be in same namespace as destination ${q(destination)}`;
|
|
1178
|
+
return accountIdTo32Bytes(caller);
|
|
1179
|
+
})();
|
|
1180
|
+
|
|
1181
|
+
return watch(
|
|
1182
|
+
E(helper.owned()).executeEncodedTx([
|
|
1183
|
+
Any.toJSON(
|
|
1184
|
+
destinationCaller
|
|
1185
|
+
? MsgDepositForBurnWithCaller.toProtoMsg({
|
|
1186
|
+
...depositForBurn,
|
|
1187
|
+
destinationCaller,
|
|
1188
|
+
})
|
|
1189
|
+
: MsgDepositForBurn.toProtoMsg(depositForBurn),
|
|
1190
|
+
),
|
|
1191
|
+
]),
|
|
1192
|
+
this.facets.returnVoidWatcher,
|
|
1193
|
+
);
|
|
1194
|
+
});
|
|
1195
|
+
},
|
|
1131
1196
|
},
|
|
1132
1197
|
},
|
|
1133
1198
|
);
|
|
@@ -78,7 +78,7 @@ declare function prepareOrchestratorKit(zone: Zone, { chainHub, makeLocalChainFa
|
|
|
78
78
|
*/
|
|
79
79
|
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo], name: string): import("@endo/exo").Guarded<{
|
|
80
80
|
getChainInfo(): Vow<any>;
|
|
81
|
-
makeAccount(): Vow<HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & object> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").LocalAccountMethods> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries>>;
|
|
81
|
+
makeAccount(): Vow<HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & object> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").LocalAccountMethods> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object & import("../cosmos-api.js").NobleMethods> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries & import("../cosmos-api.js").NobleMethods> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object> | HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries>>;
|
|
82
82
|
query(msgs: {
|
|
83
83
|
data: string;
|
|
84
84
|
path: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePowers): (remoteChainInfo: ChainInfo, connectionInfo?: IBCConnectionInfo | undefined) => import("@endo/exo").Guarded<{
|
|
2
2
|
getChainInfo(): Vow<any>;
|
|
3
|
-
makeAccount(): Vow<import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & object> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").LocalAccountMethods> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries>>;
|
|
3
|
+
makeAccount(): Vow<import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & object> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").LocalAccountMethods> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object & import("../cosmos-api.js").NobleMethods> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries & import("../cosmos-api.js").NobleMethods> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & object> | import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").OrchestrationAccountCommon & import("../cosmos-api.js").IcaAccountMethods & import("../cosmos-api.js").StakingAccountActions & import("../cosmos-api.js").StakingAccountQueries>>;
|
|
4
4
|
query(msgs: {
|
|
5
5
|
data: string;
|
|
6
6
|
path: string;
|
|
@@ -8,7 +8,7 @@ import type { Timestamp } from '@agoric/time';
|
|
|
8
8
|
import type { QueryManyFn } from '@agoric/vats/src/localchain.js';
|
|
9
9
|
import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
10
10
|
import type { Passable } from '@endo/marshal';
|
|
11
|
-
import type { AgoricChainMethods, CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, KnownChains, LocalAccountMethods, ICQQueryFunction, KnownNamespace } from './types.js';
|
|
11
|
+
import type { AgoricChainMethods, CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, KnownChains, LocalAccountMethods, ICQQueryFunction, KnownNamespace, NobleMethods } from './types.js';
|
|
12
12
|
import type { ResolvedContinuingOfferResult } from './utils/zoe-tools.js';
|
|
13
13
|
/**
|
|
14
14
|
* A denom that designates a path to a token type on some blockchain.
|
|
@@ -46,7 +46,7 @@ export type AmountArg = DenomAmount | Amount<'nat'>;
|
|
|
46
46
|
*
|
|
47
47
|
* @see {@link https://chainagnostic.org/CAIPs/caip-2}
|
|
48
48
|
*/
|
|
49
|
-
export type
|
|
49
|
+
export type CaipChainId = `${string}:${string}`;
|
|
50
50
|
/**
|
|
51
51
|
* à la CAIP-10
|
|
52
52
|
*
|
|
@@ -56,7 +56,7 @@ export type ScopedChainId = `${string}:${string}`;
|
|
|
56
56
|
*
|
|
57
57
|
* @see {@link https://chainagnostic.org/CAIPs/caip-10}
|
|
58
58
|
*/
|
|
59
|
-
export type AccountId = `${
|
|
59
|
+
export type AccountId = `${CaipChainId}:${string}`;
|
|
60
60
|
/**
|
|
61
61
|
* Specific to Cosmos chains
|
|
62
62
|
* @see {AccountId} for universal account identifier
|
|
@@ -104,7 +104,7 @@ export type Caip10Record = {
|
|
|
104
104
|
*/
|
|
105
105
|
export type OrchestrationAccount<CI extends Partial<ChainInfo>> = OrchestrationAccountCommon & (CI extends {
|
|
106
106
|
chainId: string;
|
|
107
|
-
} ? CI['chainId'] extends `agoric${string}` ? LocalAccountMethods : CosmosChainAccountMethods<CI> : object);
|
|
107
|
+
} ? CI['chainId'] extends `agoric${string}` ? LocalAccountMethods : CI['chainId'] extends `noble${string}` ? CosmosChainAccountMethods<CI> & NobleMethods : CosmosChainAccountMethods<CI> : object);
|
|
108
108
|
/**
|
|
109
109
|
* An object for access the core functions of a remote chain.
|
|
110
110
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-api.d.ts","sourceRoot":"","sources":["orchestration-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,
|
|
1
|
+
{"version":3,"file":"orchestration-api.d.ts","sourceRoot":"","sources":["orchestration-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAE1E;;;;;;;;;;GAUG;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18,6 +18,7 @@ import type {
|
|
|
18
18
|
LocalAccountMethods,
|
|
19
19
|
ICQQueryFunction,
|
|
20
20
|
KnownNamespace,
|
|
21
|
+
NobleMethods,
|
|
21
22
|
} from './types.js';
|
|
22
23
|
import type { ResolvedContinuingOfferResult } from './utils/zoe-tools.js';
|
|
23
24
|
|
|
@@ -63,7 +64,7 @@ export type AmountArg = DenomAmount | Amount<'nat'>;
|
|
|
63
64
|
*
|
|
64
65
|
* @see {@link https://chainagnostic.org/CAIPs/caip-2}
|
|
65
66
|
*/
|
|
66
|
-
export type
|
|
67
|
+
export type CaipChainId = `${string}:${string}`;
|
|
67
68
|
|
|
68
69
|
/**
|
|
69
70
|
* à la CAIP-10
|
|
@@ -74,7 +75,7 @@ export type ScopedChainId = `${string}:${string}`;
|
|
|
74
75
|
*
|
|
75
76
|
* @see {@link https://chainagnostic.org/CAIPs/caip-10}
|
|
76
77
|
*/
|
|
77
|
-
export type AccountId = `${
|
|
78
|
+
export type AccountId = `${CaipChainId}:${string}`;
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
* Specific to Cosmos chains
|
|
@@ -132,7 +133,9 @@ export type OrchestrationAccount<CI extends Partial<ChainInfo>> =
|
|
|
132
133
|
(CI extends { chainId: string }
|
|
133
134
|
? CI['chainId'] extends `agoric${string}`
|
|
134
135
|
? LocalAccountMethods
|
|
135
|
-
:
|
|
136
|
+
: CI['chainId'] extends `noble${string}`
|
|
137
|
+
? CosmosChainAccountMethods<CI> & NobleMethods
|
|
138
|
+
: CosmosChainAccountMethods<CI>
|
|
136
139
|
: object);
|
|
137
140
|
|
|
138
141
|
/**
|
|
@@ -97,12 +97,16 @@ export const startSendAnywhere = async (
|
|
|
97
97
|
const osmoIssuer = await safeFulfill(() =>
|
|
98
98
|
E(agoricNames).lookup('issuer', 'OSMO'),
|
|
99
99
|
);
|
|
100
|
+
const USDCIssuer = await safeFulfill(() =>
|
|
101
|
+
E(agoricNames).lookup('issuer', 'USDC'),
|
|
102
|
+
);
|
|
100
103
|
|
|
101
104
|
const issuerKeywordRecord = harden({
|
|
102
105
|
BLD: await BLD,
|
|
103
106
|
IST: await IST,
|
|
104
107
|
...(atomIssuer && { ATOM: atomIssuer }),
|
|
105
108
|
...(osmoIssuer && { OSMO: osmoIssuer }),
|
|
109
|
+
...(USDCIssuer && { USDC: USDCIssuer }),
|
|
106
110
|
});
|
|
107
111
|
trace('issuerKeywordRecord', issuerKeywordRecord);
|
|
108
112
|
|
package/src/utils/address.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ export function makeICAChannelAddress(hostConnectionId: IBCConnectionID, control
|
|
|
2
2
|
export const DEFAULT_ICQ_VERSION: "icq-1";
|
|
3
3
|
export function makeICQChannelAddress(controllerConnectionId: IBCConnectionID, version?: string): RemoteIbcAddress;
|
|
4
4
|
export function findAddressField(remoteAddressString: RemoteIbcAddress): CosmosChainAddress["value"] | undefined;
|
|
5
|
-
export function getBech32Prefix(address: string): string;
|
|
5
|
+
export function getBech32Prefix(address: Bech32Address | string): string;
|
|
6
6
|
export function parseAccountIdArg(idArg: AccountIdArg): Caip10Record;
|
|
7
7
|
export function parseAccountId(accountId: AccountId): Caip10Record;
|
|
8
|
+
export function leftPadEthAddressTo32Bytes(rawAddress: string): Uint8Array<ArrayBufferLike>;
|
|
9
|
+
export function accountIdTo32Bytes(accountId: AccountId): Uint8Array;
|
|
8
10
|
export type ICAChannelAddressOpts = {
|
|
9
11
|
/**
|
|
10
12
|
* message encoding format for the
|
|
@@ -28,6 +30,7 @@ export type ICAChannelAddressOpts = {
|
|
|
28
30
|
import type { IBCConnectionID } from '@agoric/vats';
|
|
29
31
|
import type { RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
30
32
|
import type { CosmosChainAddress } from '../types.js';
|
|
33
|
+
import type { Bech32Address } from '../types.js';
|
|
31
34
|
import type { AccountIdArg } from '../orchestration-api.js';
|
|
32
35
|
import type { Caip10Record } from '../orchestration-api.js';
|
|
33
36
|
import type { AccountId } from '../orchestration-api.js';
|
|
@@ -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":"AA0BO,wDALI,eAAe,0BACf,eAAe,6CACf,qBAAqB,GACnB,gBAAgB,CAuB5B;AAGD,kCAAmC,OAAO,CAAC;AAOpC,8DAJI,eAAe,YACf,MAAM,GACJ,gBAAgB,CAQ5B;AAaM,sDAJI,gBAAgB,GAEd,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS,CAYnD;AAaM,yCAHI,aAAa,GAAG,MAAM,GACpB,MAAM,CAQlB;AASM,yCAJI,YAAY,GAEV,YAAY,CAaxB;AASM,0CAHI,SAAS,GACP,YAAY,CAaxB;AAUM,uDAFI,MAAM,+BAOhB;AAOM,8CAJI,SAAS,GACP,UAAU,CAWtB;;;;;;;;;;;;;;;;;;;;;qCA3KiC,cAAc;sCAGb,iCAAiC;wCAFH,aAAa;mCAAb,aAAa;kCACtB,yBAAyB;kCAAzB,yBAAyB;+BAAzB,yBAAyB"}
|
package/src/utils/address.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Fail, q } from '@endo/errors';
|
|
2
|
+
import { fromHex } from '@cosmjs/encoding';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @import {IBCConnectionID} from '@agoric/vats';
|
|
5
|
-
* @import {CosmosChainAddress,
|
|
6
|
+
* @import {Bech32Address, CosmosChainAddress, CaipChainId} from '../types.js';
|
|
6
7
|
* @import {AccountId, AccountIdArg, Caip10Record} from '../orchestration-api.js';
|
|
7
8
|
* @import {RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
|
|
8
9
|
*/
|
|
@@ -93,7 +94,7 @@ harden(findAddressField);
|
|
|
93
94
|
* [bech32.js](https://github.com/bitcoinjs/bech32/blob/5ceb0e3d4625561a459c85643ca6947739b2d83c/src/index.ts#L146)
|
|
94
95
|
* for the reference implementation.
|
|
95
96
|
*
|
|
96
|
-
* @param {string} address - The full Bech32-encoded address.
|
|
97
|
+
* @param {Bech32Address | string} address - The full Bech32-encoded address.
|
|
97
98
|
* @returns {string} - The extracted HRP (prefix).
|
|
98
99
|
*/
|
|
99
100
|
export const getBech32Prefix = address => {
|
|
@@ -144,3 +145,32 @@ export const parseAccountId = accountId => {
|
|
|
144
145
|
};
|
|
145
146
|
};
|
|
146
147
|
harden(parseAccountId);
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Left pad the mint recipient address with 0's to 32 bytes. standard ETH
|
|
151
|
+
* addresses are 20 bytes, but for ABI data structures and other reasons, 32
|
|
152
|
+
* bytes are used.
|
|
153
|
+
*
|
|
154
|
+
* @param {string} rawAddress
|
|
155
|
+
*/
|
|
156
|
+
export const leftPadEthAddressTo32Bytes = rawAddress => {
|
|
157
|
+
const cleanedAddress = rawAddress.replace(/^0x/, '');
|
|
158
|
+
const zeroesNeeded = 64 - cleanedAddress.length;
|
|
159
|
+
const paddedAddress = '0'.repeat(zeroesNeeded) + cleanedAddress;
|
|
160
|
+
return fromHex(paddedAddress);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @param {AccountId} accountId
|
|
165
|
+
* @returns {Uint8Array}
|
|
166
|
+
* @throws {Error} if namespace not supported
|
|
167
|
+
*/
|
|
168
|
+
export const accountIdTo32Bytes = accountId => {
|
|
169
|
+
const { namespace, accountAddress } = parseAccountId(accountId);
|
|
170
|
+
switch (namespace) {
|
|
171
|
+
case 'eip155':
|
|
172
|
+
return leftPadEthAddressTo32Bytes(accountAddress);
|
|
173
|
+
default:
|
|
174
|
+
throw new Error(`namespace ${namespace} not supported`);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"AAQO,sCAHI,SAAS,GACP,WAAW,CAIvB;+BATuF,aAAa;iCAAb,aAAa"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {CaipChainId, ChainHub, ChainInfo, CosmosChainInfo, Denom, DenomDetail} from '../types.js';
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {ChainInfo} info
|
|
7
|
+
* @returns {CaipChainId}
|
|
8
|
+
*/
|
|
9
|
+
export const chainInfoCaipId = info => {
|
|
10
|
+
return `${info.namespace}:${info.reference}`;
|
|
11
|
+
};
|
|
@@ -12,6 +12,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
12
12
|
registerChain(name: string, chainInfo: import("../orchestration-api.js").ChainInfo): void;
|
|
13
13
|
updateChain(chainName: string, chainInfo: import("../orchestration-api.js").ChainInfo): void;
|
|
14
14
|
getChainInfo<K extends string>(chainName: K): import("@agoric/vow").Vow<ActualChainInfo<K>>;
|
|
15
|
+
getChainInfoByChainId(chainId: import("../orchestration-api.js").CaipChainId): import("../orchestration-api.js").ChainInfo;
|
|
15
16
|
registerConnection(primaryChainId: string, counterpartyChainId: string, connectionInfo: import("../cosmos-api.js").IBCConnectionInfo): void;
|
|
16
17
|
updateConnection(primaryChainId: string, counterpartyChainId: string, connectionInfo: import("../cosmos-api.js").IBCConnectionInfo): void;
|
|
17
18
|
getConnectionInfo(primary: string | {
|
|
@@ -24,7 +25,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
24
25
|
updateAsset(denom: import("../orchestration-api.js").Denom, detail: DenomDetail): void;
|
|
25
26
|
getAsset(denom: import("../orchestration-api.js").Denom, srcChainName: string): DenomDetail | undefined;
|
|
26
27
|
getDenom(brand: Brand): import("../orchestration-api.js").Denom | undefined;
|
|
27
|
-
resolveAccountId(partialId: string): import("../orchestration-api.js").AccountId;
|
|
28
|
+
resolveAccountId(partialId: import("../orchestration-api.js").AccountId | import("../cosmos-api.js").Bech32Address | string): import("../orchestration-api.js").AccountId;
|
|
28
29
|
makeChainAddress(partialId: string): import("../orchestration-api.js").CosmosChainAddress;
|
|
29
30
|
makeTransferRoute(destination: import("../orchestration-api.js").AccountIdArg | import("../cosmos-api.js").Bech32Address, denomAmount: import("../orchestration-api.js").DenomAmount, srcChainName: string, forwardOpts?: import("../cosmos-api.js").IBCMsgTransferOptions["forwardOpts"]): import("../cosmos-api.js").TransferRoute;
|
|
30
31
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA2DO,0CARI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU,SAElB;IAA4D,mBAAmB,GAAvE,qBAAqB,CAAC,qBAAqB,CAAC;CACpD;+BAmGU,IAAI
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA2DO,0CARI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU,SAElB;IAA4D,mBAAmB,GAAvE,qBAAqB,CAAC,qBAAqB,CAAC;CACpD;+BAmGU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA5DX,CAAC;;;;;;;;;;;;;;;;;;;;;sBA2IqlX,CAAC;;;;;;;;;;;;;;;;;;;;EA9C5lX;AA+BM,kCAfgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IAC/B,UAAU,EAAE,UAAU,CAAC;CACvB,EACQ,CAAC,cACH,CACN,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EACZ,WAAW,EAAE,EAAE,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,SACP,qBAAqB,GACnB,CAAC,GAAG,EAAE,GAAG,CAA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