Skip to content

Commit

Permalink
refactor: rename sendAnywhere -> send-anywhere
Browse files Browse the repository at this point in the history
- for consistency with other example contracts
  • Loading branch information
0xpatrickdev committed Sep 6, 2024
1 parent 99a3a43 commit fb26434
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions multichain-testing/test/send-anywhere.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const accounts = ['osmosis1', 'osmosis2', 'cosmoshub1', 'cosmoshub2'];

const contractName = 'sendAnywhere';
const contractBuilder =
'../packages/builders/scripts/testing/start-sendAnywhere.js';
'../packages/builders/scripts/testing/start-send-anywhere.js';

test.before(async t => {
const { deleteTestKeys, setupTestKeys, ...rest } = await commonSetup(t);
Expand All @@ -35,7 +35,7 @@ test.after(async t => {

const sendAnywhereScenario = test.macro({
title: (_, chainName: string, acctIdx: number) =>
`sendAnywhere ${chainName}${acctIdx}`,
`send-anywhere ${chainName}${acctIdx}`,
exec: async (t, chainName: string, acctIdx: number) => {
const config = chainConfig[chainName];
if (!config) return t.fail(`Unknown chain: ${chainName}`);
Expand All @@ -48,10 +48,10 @@ const sendAnywhereScenario = test.macro({
useChain,
} = t.context;

t.log('Create a receiving wallet for the sendAnywhere transfer');
t.log('Create a receiving wallet for the send-anywhere transfer');
const chain = useChain(chainName).chain;

t.log('Create an agoric smart wallet to initiate sendAnywhere transfer');
t.log('Create an agoric smart wallet to initiate send-anywhere transfer');
const agoricAddr = wallets[`${chainName}${acctIdx}`];
const wdUser1 = await provisionSmartWallet(agoricAddr, {
BLD: 100_000n,
Expand Down Expand Up @@ -95,7 +95,7 @@ const sendAnywhereScenario = test.macro({
const { balances } = await retryUntilCondition(
() => queryClient.queryBalances(receiver.value),
({ balances }) => 'amount' in balances[0],
`${receiver.value} ${amount.value} balance available from sendAnywhere`,
`${receiver.value} ${amount.value} balance available from send-anywhere`,
);

t.log(`${receiver.value} Balances`, balances);
Expand Down
10 changes: 5 additions & 5 deletions packages/boot/test/orchestration/restart-contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test.after.always(t => t.context.shutdown?.());

// FIXME the test needs to be able to send the acknowledgementPacket ack
// so that the transfer vow resolves.
test.serial.failing('sendAnywhere', async t => {
test.serial.failing('send-anywhere', async t => {
const {
walletFactoryDriver,
buildProposal,
Expand All @@ -30,9 +30,9 @@ test.serial.failing('sendAnywhere', async t => {

const { IST } = t.context.agoricNamesRemotes.brand;

t.log('start sendAnywhere');
t.log('start send-anywhere');
await evalProposal(
buildProposal('@agoric/builders/scripts/testing/start-sendAnywhere.js'),
buildProposal('@agoric/builders/scripts/testing/start-send-anywhere.js'),
);

t.log('making offer');
Expand Down Expand Up @@ -73,9 +73,9 @@ test.serial.failing('sendAnywhere', async t => {
t.is(await flushInboundQueue(), 0);
t.deepEqual(wallet.getLatestUpdateRecord(), beforeFlush);

t.log('restart sendAnywhere');
t.log('restart send-anywhere');
await evalProposal(
buildProposal('@agoric/builders/scripts/testing/restart-sendAnywhere.js'),
buildProposal('@agoric/builders/scripts/testing/restart-send-anywhere.js'),
);

const conclusion = wallet.getLatestUpdateRecord();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { E } from '@endo/far';
const trace = makeTracer('StartSA', true);

/**
* @import {start as StartFn} from '@agoric/orchestration/src/examples/sendAnywhere.contract.js';
* @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
*/

/**
Expand Down Expand Up @@ -87,7 +87,7 @@ export const getManifest = () => {
export const defaultProposalBuilder = async () =>
harden({
// Somewhat unorthodox, source the exports from this builder module
sourceSpec: '@agoric/builders/scripts/testing/restart-sendAnywhere.js',
sourceSpec: '@agoric/builders/scripts/testing/restart-send-anywhere.js',
getManifestCall: [getManifest.name],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { E } from '@endo/far';
const trace = makeTracer('StartSA', true);

/**
* @import {start as StartFn} from '@agoric/orchestration/src/examples/sendAnywhere.contract.js';
* @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
*/

/**
Expand Down Expand Up @@ -61,14 +61,14 @@ export const startSendAnywhere = async ({
marshaller,
orchestrationService: cosmosInterchainService,
storageNode: E(NonNullish(await chainStorage)).makeChildNode(
'sendAnywhere',
'send-anywhere',
),
timerService: chainTimerService,
}),
);

const { instance } = await E(startUpgradable)({
label: 'sendAnywhere',
label: 'send-anywhere',
installation: sendAnywhere,
issuerKeywordRecord: { Stable: await IST },
privateArgs,
Expand Down Expand Up @@ -113,13 +113,13 @@ export const getManifest = ({ restoreRef }, { installationRef }) => {
export const defaultProposalBuilder = async ({ publishRef, install }) =>
harden({
// Somewhat unorthodox, source the exports from this builder module
sourceSpec: '@agoric/builders/scripts/testing/start-sendAnywhere.js',
sourceSpec: '@agoric/builders/scripts/testing/start-send-anywhere.js',
getManifestCall: [
getManifest.name,
{
installationRef: publishRef(
install(
'@agoric/orchestration/src/examples/sendAnywhere.contract.js',
'@agoric/orchestration/src/examples/send-anywhere.contract.js',
),
),
},
Expand Down
6 changes: 3 additions & 3 deletions packages/orchestration/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See [`src/examples`](src/examples)
| [auto-stake-it](/packages/orchestration/src/examples/auto-stake-it.contract.js) | Ready 🟢 | Sets up an IBC hook to automatically stake tokens on a remote chain received at a deposit address. | - `LocalOrchestrationAccount`<br>- `CosmosOrchestrationAccount`<br>- `Vtransfer` (IBC Hooks) |
| [basic-flows](/packages/orchestration/src/examples/basic-flows.contract.js) | Ready 🟢 | Creates an account on a remote chain and returns a continuing offer with all platform-provided invitationMakers. | - `CosmosOrchestrationAccount`<br>- `LocalOrchestrationAccount`|
| [query-flows](/packages/orchestration/src/fixtures/query-flows.contract.js) | Ready 🟢 | Test fixture that enables querying account balances on local and remote chains. | - `Chain`<br>- `LocalOrchestrationAccount`<br>- `CosmosOrchestrationAccount`<br>- Interchain Queries |
| [sendAnywhere](/packages/orchestration/src/examples/sendAnywhere.contract.js) | Ready 🟢 | Allows sending payments (tokens) over IBC to another chain. | - `LocalOrchestrationAccoun`t<br>- `Vtransfer` (IBC Hooks) |
| [send-anywhere](/packages/orchestration/src/examples/send-anywhere.contract.js) | Ready 🟢 | Allows sending payments (tokens) over IBC to another chain. | - `LocalOrchestrationAccoun`t<br>- `Vtransfer` (IBC Hooks) |
| [stakeBld](/packages/orchestration/src/examples/stakeBld.contract.js) | Ready 🟢 | Returns a `LocalOrchestrationAccount` that can perform staking actions. | - `LocalOrchestrationAccount` | Ready 🟢 |
| [stakeIca](/packages/orchestration/src/examples/stakeIca.contract.js) | Ready 🟢 | Returns a `CosmosOrchestrationAccount` that can perform staking actions. | - `CosmosOrchestrationAccount` | Ready 🟢 |
| [staking-combinations](/packages/orchestration/src/examples/staking-combinations.contract.js) | Under Construction 🚧 | Combines actions into a single offer flow and demonstrates writing continuing offers. | - `CosmosOrchestrationAccount`<br>- `CombineInvitationMakers` <br>- Continuing Offers |
Expand All @@ -30,15 +30,15 @@ See [`src/examples`](src/examples)
| [basic-flows](/multichain-testing/test/basic-flows.test.ts) | Verifies the creation of a remote chain account and the generation of a continuing offer with various invitationMakers. | basic-flows | - `orch.getChain()`<br>- `orch.makeAccount()` |
| [chain-queries](/multichain-testing/test/chain-queries.test.ts) | Tests balance queries via ICQ and local chain queries, including error handling for chains with ICQ disabled. | query-flows | - `orch.getChain()`<br>- `chain.query()` |
| [ica-channel-close](/multichain-testing/test/ica-channel-close.test.ts) | Tests ICA account deactivation and reactivation, and verifies channel closure processes for ICA and Transfer channels. | basic-flows | - `orch.getChain()`<br>- `orch.makeAccount()`<br>- `orchAccount.deactivate()`<br>- `orchAccount.reactivate()` |
| [send-anywhere](/multichain-testing/test/send-anywhere.test.ts) | Tests the process of sending payments over IBC, including account creation, deposit, and transfer operations. | sendAnywhere | - `orch.getChain()`<br>- `chain.getVBankAssetInfo()`<br>- `chain.makeAccount()`<br>- `localOrchAccount.makeAccount()`<br>- `localOrchAccount.deposit()`<br>- `localOrchAccount.transfer()`<br>- `zoeTools.localTransfer()` |
| [send-anywhere](/multichain-testing/test/send-anywhere.test.ts) | Tests the process of sending payments over IBC, including account creation, deposit, and transfer operations. | send-anywhere | - `orch.getChain()`<br>- `chain.getVBankAssetInfo()`<br>- `chain.makeAccount()`<br>- `localOrchAccount.makeAccount()`<br>- `localOrchAccount.deposit()`<br>- `localOrchAccount.transfer()`<br>- `zoeTools.localTransfer()` |
| [stake-ica](/multichain-testing/test/stake-ica.test.ts) | Verifies staking operations including delegation, reward withdrawal, and undelegation. | stakeIca | - `orch.getChain()`<br>- `orch.makeAccount()`<br>- `orchAccount.delegate()`<br>- `orchAccount.withdrawReward()`<br>- `orchAccount.undelegate()` |

## Not Yet Tested

| Contract Name | Not Yet Tested Features |
|---------------|--------------------------|
| [basic-flows](/packages/orchestration/src/examples/basic-flows.contract.js) | - `.send()`, `sendAll()` methods and `Send`, `SendAll` invitations ([#9193](https://github.com/Agoric/agoric-sdk/issues/9193))<br>- `CosmosOrchAccount.transfer()`, `Transfer` invitation ([#9193](https://github.com/Agoric/agoric-sdk/issues/9193)) |
| [sendAnywhere](/packages/orchestration/src/examples/sendAnywhere.contract.js) | - Multi-hop (PFM) transfers (not implemented in contract) ([#10006](https://github.com/Agoric/agoric-sdk/issues/10006)) |
| [send-anywhere](/packages/orchestration/src/examples/send-anywhere.contract.js) | - Multi-hop (PFM) transfers (not implemented in contract) ([#10006](https://github.com/Agoric/agoric-sdk/issues/10006)) |
| [stakeIca](/packages/orchestration/src/examples/stakeIca.contract.js) | - Redelegate<br>- WithdrawRewards (plural) (not implemented)<br>- StakingQueries (not implemented) ([#10016](https://github.com/Agoric/agoric-sdk/issues/10016))<br>- Staking Flows for LocalOrchAccount<br> - Written as async-flow ([#9838](https://github.com/Agoric/agoric-sdk/issues/9838)) |
| [stakeBld](/packages/orchestration/src/examples/stakeBld.contract.js) | - Everything*, created before e2e test suite<br> - Consider folding under generic "stake" contract, once [interfaces are the same](https://github.com/Agoric/agoric-sdk/blob/1976c502bcaac2e7d21f42b30447671a61053236/packages/orchestration/src/exos/local-orchestration-account.js#L487)|
| [swap](/packages/orchestration/src/examples/swap.contract.js) | - Everything - contract incomplete ([#8863](https://github.com/Agoric/agoric-sdk/issues/8863)) |
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This directory contains sample contracts showcasing the Orchestration API. Each example demonstrates specific functionalities:

- **basic-flows.contract.js**: Account creation and query sending
- **sendAnywhere.contract.js**: Token sending across supported blockchains
- **send-anywhere.contract.js**: Token sending across supported blockchains
- **auto-stake-it.contract.js**: Automatic remote staking of received tokens

## In Progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AmountShape } from '@agoric/ertp';
import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
import { M } from '@endo/patterns';
import { withOrchestration } from '../utils/start-helper.js';
import * as flows from './sendAnywhere.flows.js';
import * as flows from './send-anywhere.flows.js';
import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import {
import { inspect } from 'util';
import { CosmosChainInfo, IBCConnectionInfo } from '../../src/cosmos-api.js';
import { commonSetup } from '../supports.js';
import { SingleAmountRecord } from '../../src/examples/sendAnywhere.contract.js';
import { SingleAmountRecord } from '../../src/examples/send-anywhere.contract.js';
import { registerChain } from '../../src/chain-info.js';
import { buildVTransferEvent } from '../../tools/ibc-mocks.js';

const dirname = path.dirname(new URL(import.meta.url).pathname);

const contractName = 'sendAnywhere';
const contractFile = `${dirname}/../../src/examples/${contractName}.contract.js`;
const contractFile = `${dirname}/../../src/examples/send-anywhere.contract.js`;
type StartFn =
typeof import('../../src/examples/sendAnywhere.contract.js').start;
typeof import('../../src/examples/send-anywhere.contract.js').start;

const chainInfoDefaults = {
connections: {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/examples/sendAnywhere.test.ts`
# Snapshot report for `test/examples/send-anywhere.test.ts`

The actual snapshot is saved in `sendAnywhere.test.ts.snap`.
The actual snapshot is saved in `send-anywhere.test.ts.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down

0 comments on commit fb26434

Please sign in to comment.