Skip to content

fix(sdk-coin-fetchai): change asset name from fetch to fetchai #6149

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

Merged
merged 1 commit into from
May 20, 2025
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
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
/modules/sdk-coin-cspr/ @BitGo/ethalt-team
/modules/sdk-coin-dot/ @BitGo/ethalt-team
/modules/sdk-coin-eos/ @BitGo/ethalt-team
/modules/sdk-coin-fetch/ @BitGo/ethalt-team
/modules/sdk-coin-fetchai/ @BitGo/ethalt-team
/modules/sdk-coin-flr/ @BitGo/ethalt-team
/modules/sdk-coin-ethlike/ @BitGo/ethalt-team
/modules/sdk-coin-hbar/ @BitGo/ethalt-team
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ COPY --from=builder /tmp/bitgo/modules/sdk-coin-cronos /var/modules/sdk-coin-cro
COPY --from=builder /tmp/bitgo/modules/sdk-coin-cspr /var/modules/sdk-coin-cspr/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-dot /var/modules/sdk-coin-dot/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-etc /var/modules/sdk-coin-etc/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-fetch /var/modules/sdk-coin-fetch/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-fetchai /var/modules/sdk-coin-fetchai/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-flr /var/modules/sdk-coin-flr/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-hash /var/modules/sdk-coin-hash/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-hbar /var/modules/sdk-coin-hbar/
Expand Down Expand Up @@ -169,7 +169,7 @@ cd /var/modules/sdk-coin-cronos && yarn link && \
cd /var/modules/sdk-coin-cspr && yarn link && \
cd /var/modules/sdk-coin-dot && yarn link && \
cd /var/modules/sdk-coin-etc && yarn link && \
cd /var/modules/sdk-coin-fetch && yarn link && \
cd /var/modules/sdk-coin-fetchai && yarn link && \
cd /var/modules/sdk-coin-flr && yarn link && \
cd /var/modules/sdk-coin-hash && yarn link && \
cd /var/modules/sdk-coin-hbar && yarn link && \
Expand Down Expand Up @@ -265,7 +265,7 @@ RUN cd /var/bitgo-express && \
yarn link @bitgo/sdk-coin-cspr && \
yarn link @bitgo/sdk-coin-dot && \
yarn link @bitgo/sdk-coin-etc && \
yarn link @bitgo/sdk-coin-fetch && \
yarn link @bitgo/sdk-coin-fetchai && \
yarn link @bitgo/sdk-coin-flr && \
yarn link @bitgo/sdk-coin-hash && \
yarn link @bitgo/sdk-coin-hbar && \
Expand Down
2 changes: 1 addition & 1 deletion modules/account-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@bitgo/sdk-coin-dot": "^4.1.57",
"@bitgo/sdk-coin-etc": "^2.2.46",
"@bitgo/sdk-coin-eth": "^24.4.2",
"@bitgo/sdk-coin-fetch": "^1.1.0",
"@bitgo/sdk-coin-fetchai": "^1.1.0",
"@bitgo/sdk-coin-flr": "^1.2.3",
"@bitgo/sdk-coin-hash": "^3.0.48",
"@bitgo/sdk-coin-hbar": "^2.0.79",
Expand Down
8 changes: 4 additions & 4 deletions modules/account-lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export { Mantra };
import * as Cronos from '@bitgo/sdk-coin-cronos';
export { Cronos };

import * as Fetch from '@bitgo/sdk-coin-fetch';
export { Fetch };
import * as FetchAi from '@bitgo/sdk-coin-fetchai';
export { FetchAi };

import * as Initia from '@bitgo/sdk-coin-initia';
export { Initia };
Expand Down Expand Up @@ -272,8 +272,8 @@ const coinBuilderMap = {
tbaby: Baby.TransactionBuilder,
cronos: Cronos.TransactionBuilder,
tcronos: Cronos.TransactionBuilder,
fetch: Fetch.TransactionBuilder,
tfetch: Fetch.TransactionBuilder,
fetchai: FetchAi.TransactionBuilder,
tfetchai: FetchAi.TransactionBuilder,
initia: Initia.TransactionBuilder,
tinitia: Initia.TransactionBuilder,
flr: Flr.TransactionBuilder,
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@bitgo/sdk-coin-eth": "^24.4.2",
"@bitgo/sdk-coin-ethlike": "^1.2.14",
"@bitgo/sdk-coin-ethw": "^20.0.79",
"@bitgo/sdk-coin-fetch": "^1.1.0",
"@bitgo/sdk-coin-fetchai": "^1.1.0",
"@bitgo/sdk-coin-flr": "^1.2.3",
"@bitgo/sdk-coin-hash": "^3.0.48",
"@bitgo/sdk-coin-hbar": "^2.0.79",
Expand Down
8 changes: 4 additions & 4 deletions modules/bitgo/src/v2/coinFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
Eth,
Ethw,
EthLikeCoin,
Fetch,
FetchAi,
Flr,
TethLikeCoin,
FiatAED,
Expand Down Expand Up @@ -121,7 +121,7 @@ import {
Teos,
Tetc,
Teth,
Tfetch,
TfetchAi,
Tflr,
Tmon,
TfiatAED,
Expand Down Expand Up @@ -219,7 +219,7 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
coinFactory.register('fiatgbp', FiatGBP.createInstance);
coinFactory.register('fiatsgd', FiatSGD.createInstance);
coinFactory.register('fiatusd', FiatUsd.createInstance);
coinFactory.register('fetch', Fetch.createInstance);
coinFactory.register('fetchai', FetchAi.createInstance);
coinFactory.register('flr', Flr.createInstance);
coinFactory.register('gteth', Gteth.createInstance);
coinFactory.register('hash', Hash.createInstance);
Expand Down Expand Up @@ -287,7 +287,7 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
coinFactory.register('tfiatgbp', TfiatGBP.createInstance);
coinFactory.register('tfiatsgd', TfiatSGD.createInstance);
coinFactory.register('tfiatusd', TfiatUsd.createInstance);
coinFactory.register('tfetch', Tfetch.createInstance);
coinFactory.register('tfetchai', TfetchAi.createInstance);
coinFactory.register('tflr', Tflr.createInstance);
coinFactory.register('tmon', Tmon.createInstance);
coinFactory.register('thash', Thash.createInstance);
Expand Down
4 changes: 2 additions & 2 deletions modules/bitgo/src/v2/coins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Dot, Tdot } from '@bitgo/sdk-coin-dot';
import { Eos, EosToken, Teos } from '@bitgo/sdk-coin-eos';
import { Etc, Tetc } from '@bitgo/sdk-coin-etc';
import { Erc20Token, Eth, Gteth, Hteth, Teth } from '@bitgo/sdk-coin-eth';
import { Fetch, Tfetch } from '@bitgo/sdk-coin-fetch';
import { FetchAi, TfetchAi } from '@bitgo/sdk-coin-fetchai';
import { Flr, Tflr } from '@bitgo/sdk-coin-flr';
import { Ethw } from '@bitgo/sdk-coin-ethw';
import { EthLikeCoin, TethLikeCoin } from '@bitgo/sdk-coin-ethlike';
Expand Down Expand Up @@ -100,7 +100,7 @@ export { Erc20Token, Eth, Gteth, Hteth, Teth };
export { Ethw };
export { EthLikeCoin, TethLikeCoin };
export { Etc, Tetc };
export { Fetch, Tfetch };
export { FetchAi, TfetchAi };
export { Flr, Tflr };
export { Hash, Thash };
export { Hbar, Thbar };
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/test/v2/unit/keychains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('V2 Keychains', function () {
n.asset !== UnderlyingAsset.SONEIUM &&
n.asset !== UnderlyingAsset.VET &&
n.asset !== UnderlyingAsset.CRONOS &&
n.asset !== UnderlyingAsset.FETCH &&
n.asset !== UnderlyingAsset.FETCHAI &&
n.asset !== UnderlyingAsset.INITIA &&
coinFamilyValues.includes(n.name)
);
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"path": "../sdk-coin-ethw"
},
{
"path": "../sdk-coin-fetch"
"path": "../sdk-coin-fetchai"
},
{
"path": "../sdk-coin-flr"
Expand Down
4 changes: 0 additions & 4 deletions modules/sdk-coin-fetch/src/index.ts

This file was deleted.

8 changes: 0 additions & 8 deletions modules/sdk-coin-fetch/src/register.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# BitGo sdk-coin-fetch
# BitGo sdk-coin-fetchai

SDK coins provide a modular approach to a monolithic architecture. This and all BitGoJS SDK coins allow developers to use only the coins needed for a given project.

## Installation

All coins are loaded traditionally through the `bitgo` package. If you are using coins individually, you will be accessing the coin via the `@bitgo/sdk-api` package.

In your project install both `@bitgo/sdk-api` and `@bitgo/sdk-coin-fetch`.
In your project install both `@bitgo/sdk-api` and `@bitgo/sdk-coin-fetchai`.

```shell
npm i @bitgo/sdk-api @bitgo/sdk-coin-fetch
npm i @bitgo/sdk-api @bitgo/sdk-coin-fetchai
```

Next, you will be able to initialize an instance of "bitgo" through `@bitgo/sdk-api` instead of `bitgo`.

```javascript
import { BitGoAPI } from '@bitgo/sdk-api';
import { Fetch } from '@bitgo/sdk-coin-fetch';
import { FetchAi } from '@bitgo/sdk-coin-fetchai';

const sdk = new BitGoAPI();

sdk.register('fetch', Fetch.createInstance);
sdk.register('fetchai', FetchAi.createInstance);
```

## Development
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bitgo/sdk-coin-fetch",
"name": "@bitgo/sdk-coin-fetchai",
"version": "1.1.0",
"description": "BitGo SDK coin library for Fetch",
"description": "BitGo SDK coin library for Fetch.ai",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
Expand All @@ -23,7 +23,7 @@
"repository": {
"type": "git",
"url": "https://github.com/BitGo/BitGoJS.git",
"directory": "modules/sdk-coin-fetch"
"directory": "modules/sdk-coin-fetchai"
},
"lint-staged": {
"*.{js,ts}": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import utils from './lib/utils';
* Docs: https://website.prod.fetch-ai.com/docs/
* GitHub : https://github.com/fetchai
*/
export class Fetch extends CosmosCoin {
export class FetchAi extends CosmosCoin {
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;

protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>) {
Expand All @@ -26,7 +26,7 @@ export class Fetch extends CosmosCoin {
}

static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin {
return new Fetch(bitgo, staticsCoin);
return new FetchAi(bitgo, staticsCoin);
}

/** @inheritDoc **/
Expand All @@ -46,7 +46,7 @@ export class Fetch extends CosmosCoin {

/** @inheritDoc **/
getDenomination(): string {
return BaseUnit.FETCH;
return BaseUnit.FETCHAI;
}

/** @inheritDoc **/
Expand All @@ -64,7 +64,7 @@ export class Fetch extends CosmosCoin {

/** @inheritDoc **/
protected getPublicNodeUrl(): string {
return Environments[this.bitgo.getEnv()].fetchNodeUrl;
return Environments[this.bitgo.getEnv()].fetchAiNodeUrl;
}

/** @inheritDoc **/
Expand Down
4 changes: 4 additions & 0 deletions modules/sdk-coin-fetchai/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './lib';
export * from './register';
export * from './fetchai';
export * from './tfetchai';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CosmosKeyPair } from '@bitgo/abstract-cosmos';
import { ADDRESS_PREFIX } from './constants';

/**
* Fetch keys and address management.
* Fetch.ai keys and address management.
*/
export class KeyPair extends CosmosKeyPair {
constructor(source?: KeyPairOptions) {
Expand Down
8 changes: 8 additions & 0 deletions modules/sdk-coin-fetchai/src/register.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BitGoBase } from '@bitgo/sdk-core';
import { FetchAi } from './fetchai';
import { TfetchAi } from './tfetchai';

export const register = (sdk: BitGoBase): void => {
sdk.register('fetchai', FetchAi.createInstance);
sdk.register('tfetchai', TfetchAi.createInstance);
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BaseCoin, BitGoBase } from '@bitgo/sdk-core';
import { BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
import { Fetch } from './fetch';
import { FetchAi } from './fetchai';

export class Tfetch extends Fetch {
export class TfetchAi extends FetchAi {
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>) {
super(bitgo, staticsCoin);
Expand All @@ -15,6 +15,6 @@ export class Tfetch extends Fetch {
}

static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin {
return new Tfetch(bitgo, staticsCoin);
return new TfetchAi(bitgo, staticsCoin);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import BigNumber from 'bignumber.js';
import sinon from 'sinon';
import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
import { BitGoAPI } from '@bitgo/sdk-api';
import { Fetch, Tfetch } from '../../src/index';
import { FetchAi, TfetchAi } from '../../src/index';
import utils from '../../src/lib/utils';
import { TEST_SEND_MANY_TX, TEST_SEND_TX, TEST_TX_WITH_MEMO, address, TEST_ACCOUNT } from '../resources/fetch';
import { TEST_SEND_MANY_TX, TEST_SEND_TX, TEST_TX_WITH_MEMO, address, TEST_ACCOUNT } from '../resources/fetchai';

const bitgo: TestBitGoAPI = TestBitGo.decorate(BitGoAPI, { env: 'test' });
const coinString = 'fetch';
const testCoinString = 'tfetch';
const coinString = 'fetchai';
const testCoinString = 'tfetchai';
const coinFullName = 'Fetch';
const testCoinFullName = 'Testnet Fetch';
const baseFactor = 1e18;
const coinInstance = Fetch.createInstance;
const testCoinInstance = Tfetch.createInstance;
const coinInstance = FetchAi.createInstance;
const testCoinInstance = TfetchAi.createInstance;
bitgo.safeRegister(testCoinString, testCoinInstance);

describe('Fetch', function () {
describe('Fetch.ai', function () {
let bitgo: TestBitGoAPI;
let basecoin;

Expand All @@ -30,18 +30,18 @@ describe('Fetch', function () {
});

it('should return the right info', function () {
const fetch = bitgo.coin(coinString);
const tfetch = bitgo.coin(testCoinString);
const fetchai = bitgo.coin(coinString);
const tfetchai = bitgo.coin(testCoinString);

fetch.getChain().should.equal(coinString);
fetch.getFamily().should.equal(coinString);
fetch.getFullName().should.equal(coinFullName);
fetch.getBaseFactor().should.equal(baseFactor);
fetchai.getChain().should.equal(coinString);
fetchai.getFamily().should.equal(coinString);
fetchai.getFullName().should.equal(coinFullName);
fetchai.getBaseFactor().should.equal(baseFactor);

tfetch.getChain().should.equal(testCoinString);
tfetch.getFamily().should.equal(coinString);
tfetch.getFullName().should.equal(testCoinFullName);
tfetch.getBaseFactor().should.equal(baseFactor);
tfetchai.getChain().should.equal(testCoinString);
tfetchai.getFamily().should.equal(coinString);
tfetchai.getFullName().should.equal(testCoinFullName);
tfetchai.getBaseFactor().should.equal(baseFactor);
});

describe('Address Validation', () => {
Expand Down Expand Up @@ -265,7 +265,7 @@ describe('Fetch', function () {
});

it('should fail to parse a transfer transaction when explainTransaction response is undefined', async function () {
const stub = sinon.stub(Fetch.prototype, 'explainTransaction');
const stub = sinon.stub(FetchAi.prototype, 'explainTransaction');
stub.resolves(undefined);
await basecoin
.parseTransaction({ txHex: TEST_SEND_TX.signedTxBase64 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import assert from 'assert';
import should from 'should';

import { KeyPair } from '../../src';
import { TEST_ACCOUNT, TEST_SEND_TX } from '../resources/fetch';
import { TEST_ACCOUNT, TEST_SEND_TX } from '../resources/fetchai';

describe('Fetch Key Pair', () => {
describe('Fetch.ai Key Pair', () => {
describe('should create a valid KeyPair', () => {
it('from an empty value', () => {
const keyPairObj = new KeyPair();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { fromBase64 } from '@cosmjs/encoding';
import should from 'should';
import { Transaction } from '../../src';
import utils from '../../src/lib/utils';
import * as testData from '../resources/fetch';
import * as testData from '../resources/fetchai';

describe('Fetch Transaction', () => {
describe('Fetch.ai Transaction', () => {
let tx: Transaction;
const testCoinString = 'tfetch';
const testCoinString = 'tfetchai';
const config = coins.get(testCoinString);

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TransactionType } from '@bitgo/sdk-core';
import should from 'should';

import * as testData from '../../resources/fetch';
import * as testData from '../../resources/fetchai';
import { getBuilderFactory } from '../getBuilderFactory';

describe('Fetch Transaction Builder', async () => {
const testCoinString = 'tfetch';
describe('Fetch.ai Transaction Builder', async () => {
const testCoinString = 'tfetchai';
const factory = getBuilderFactory(testCoinString);
const testTxData = testData.TEST_SEND_TX;
let data;
Expand Down
Loading